-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3814572
commit 669a235
Showing
3 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env python3 | ||
"""A plugin which returns any attempt with a spend transaction sending funds to unknown addresses""" | ||
|
||
import json | ||
import sys | ||
import bitcoin | ||
|
||
|
||
def read_request(): | ||
"""Read a JSON request from stdin up to the '\n' delimiter.""" | ||
buf = "" | ||
while len(buf) == 0 or buf[-1] != "\n": | ||
buf += sys.stdin.read() | ||
return json.loads(buf) | ||
|
||
|
||
if __name__ == "__main__": | ||
req = read_request() | ||
block_info = req["block_info"] | ||
whitelist_file = open(req["config"]["whitelist_file_path"], 'r') | ||
whitelist = map(lambda address: address.strip(), whitelist_file.readlines()) | ||
|
||
vaults_without_spend_outpoints = [] | ||
for vault in block_info["new_attempts"]: | ||
if vault["candidate_tx"] is None: | ||
vaults_without_spend_outpoints.append(vault["deposit_outpoint"]) | ||
else: | ||
candidate_tx = bitcoin.deserialize(vault["candidate_tx"]) | ||
vaults_without_spend_outpoints.append(vault["deposit_outpoint"]) | ||
|
||
resp = {"revault": vaults_without_spend_outpoints} | ||
sys.stdout.write(json.dumps(resp)) | ||
sys.stdout.flush() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters