MCPcopy Create free account
hub / github.com/ElementsProject/elements / update_fee

Method update_fee

test/functional/feature_block.py:1366–1376  ·  view source on GitHub ↗
(self, tx, prev_tx, prev_n)

Source from the content-addressed store, hash-verified

1364
1365 # update the fee output amount and also move it to the end
1366 def update_fee(self, tx, prev_tx, prev_n):
1367 total_out = 0
1368 for i in reversed(range(len(tx.vout))):
1369 if tx.vout[i].is_fee():
1370 del tx.vout[i]
1371 else:
1372 total_out += tx.vout[i].nValue.getAmount()
1373 fee = prev_tx.vout[prev_n].nValue.getAmount() - total_out
1374 if fee > 0:
1375 tx.vout.append(CTxOut(fee))
1376 tx.calc_sha256()
1377
1378 # sign a transaction, using the key we know about
1379 # this signs input 0 in tx, which is assumed to be spending output 0 in spend_tx

Callers 1

run_testMethod · 0.95

Calls 4

CTxOutClass · 0.90
is_feeMethod · 0.80
getAmountMethod · 0.80
calc_sha256Method · 0.45

Tested by

no test coverage detected