mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
Limit send-to-sidechain transaction size to avoid un-claimable transactions.
This commit is contained in:
parent
60c582aae4
commit
fffc59179f
1 changed files with 20 additions and 1 deletions
|
|
@ -118,7 +118,26 @@ try:
|
|||
print("Sending %s to %s..." % (sys.argv[3], send_address))
|
||||
print("(nonce: %s)" % nonce)
|
||||
|
||||
txid = bitcoin.sendtoaddress(send_address, Decimal(sys.argv[3]))
|
||||
try:
|
||||
tx_hex = bitcoin.createrawtransaction([], {send_address: Decimal(sys.argv[3])})
|
||||
tx_hex = bitcoin.fundrawtransaction(tx_hex)['hex']
|
||||
tx = bitcoin.signrawtransaction(tx_hex)
|
||||
assert(tx['complete'])
|
||||
|
||||
tx_hex = tx['hex']
|
||||
|
||||
total_length = len(tx_hex)/2
|
||||
total_length += 14*32
|
||||
total_length += 1000 # wild guess
|
||||
|
||||
if total_length >= 10000:
|
||||
print("Transaction is too large.")
|
||||
exit(1)
|
||||
|
||||
txid = bitcoin.sendrawtransaction(tx_hex)
|
||||
except:
|
||||
txid = bitcoin.sendtoaddress(send_address, Decimal(sys.argv[3]))
|
||||
|
||||
print("Sent tx with id %s" % txid)
|
||||
elif sys.argv[1] == "claim-on-sidechain":
|
||||
if len(sys.argv) != 5:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue