From 692e1108aeccc25c4ddf9e6d4594004b40bb8204 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 10 Mar 2019 04:51:33 +0000 Subject: [PATCH] use integers, sometimes python doesn't know how to deal with decimals --- OP_RETURN.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OP_RETURN.py b/OP_RETURN.py index 594bc8d..69fc721 100644 --- a/OP_RETURN.py +++ b/OP_RETURN.py @@ -55,6 +55,7 @@ OP_RETURN_NET_TIMEOUT=10 # how long to time out (in seconds) when communicating with bitcoin node +SAT = 100000000 # coin divisible by how many satoshis # User-facing functions @@ -149,7 +150,9 @@ def OP_RETURN_store(data, testnet=False): # Some preparation for this iteration last_txn=((data_ptr+OP_RETURN_MAX_BYTES)>=data_len) # is this the last tx in the chain? - change_amount=input_amount-OP_RETURN_BTC_FEE + change_amount = ( + int(input_amount * SAT) - int(OP_RETURN_BTC_FEE * SAT) + ) / SAT metadata=data[data_ptr:data_ptr+OP_RETURN_MAX_BYTES] # Build and send this transaction