Skip to content

Commit

Permalink
drop swap_outputs_in_rawtx and DecimalEncoder in smartfees.py
Browse files Browse the repository at this point in the history
  • Loading branch information
PastaPastaPasta committed Mar 8, 2019
1 parent bc593c8 commit 85ffc1d
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions qa/rpc-tests/smartfees.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,6 @@

global log

class DecimalEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, Decimal):
return float(o)
return super(DecimalEncoder, self).default(o)

def swap_outputs_in_rawtx(rawtx, outputs, inputnum):
'''
Since dictionaries in python are unsorted make sure that our outputs are correctly ordered.
Note: comparing strings to get "correct order" is based on the fact that
P2SH_1 string is < P2SH_2 string in this particular case.
'''
outputs_unordered = json.dumps(outputs, cls=DecimalEncoder)
outputs_ordered = json.dumps(outputs, sort_keys=True, cls=DecimalEncoder)
if outputs_ordered != outputs_unordered: # nope, we need to do some work here
first_rawoutput = rawtx[12+82*inputnum:12+82*inputnum+64]
second_rawoutput = rawtx[12+82*inputnum+64:12+82*inputnum+64+64]
rawtx = rawtx[0:12+82*inputnum] + second_rawoutput + first_rawoutput + rawtx[12+82*inputnum+64+64:]
return rawtx

def small_txpuzzle_randfee(from_node, conflist, unconflist, amount, min_fee, fee_increment):
"""
Create and send a transaction with a random fee.
Expand Down

0 comments on commit 85ffc1d

Please sign in to comment.