Changeset View
Changeset View
Standalone View
Standalone View
test/functional/rpc_rawtransaction.py
Show First 20 Lines • Show All 604 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
rawTx = self.nodes[2].createrawtransaction(inputs, outputs) | rawTx = self.nodes[2].createrawtransaction(inputs, outputs) | ||||
rawTxSigned = self.nodes[2].signrawtransactionwithwallet(rawTx) | rawTxSigned = self.nodes[2].signrawtransactionwithwallet(rawTx) | ||||
assert_equal(rawTxSigned['complete'], True) | assert_equal(rawTxSigned['complete'], True) | ||||
# Fee 10,000 satoshis, ~200 b transaction, fee rate should land around 50 sat/byte = 0.00050000 BCH/kB | # Fee 10,000 satoshis, ~200 b transaction, fee rate should land around 50 sat/byte = 0.00050000 BCH/kB | ||||
# Thus, testmempoolaccept should reject | # Thus, testmempoolaccept should reject | ||||
testres = self.nodes[2].testmempoolaccept( | testres = self.nodes[2].testmempoolaccept( | ||||
[rawTxSigned['hex']], 0.00050000)[0] | [rawTxSigned['hex']], 0.00050000)[0] | ||||
assert_equal(testres['allowed'], False) | assert_equal(testres['allowed'], False) | ||||
assert_equal(testres['reject-reason'], '256: absurdly-high-fee') | assert_equal(testres['reject-reason'], 'absurdly-high-fee') | ||||
# and sendrawtransaction should throw | # and sendrawtransaction should throw | ||||
assert_raises_rpc_error(-26, | assert_raises_rpc_error(-26, | ||||
"absurdly-high-fee", | "absurdly-high-fee", | ||||
self.nodes[2].sendrawtransaction, | self.nodes[2].sendrawtransaction, | ||||
rawTxSigned['hex'], | rawTxSigned['hex'], | ||||
0.00001000) | 0.00001000) | ||||
# and the following calls should both succeed | # and the following calls should both succeed | ||||
testres = self.nodes[2].testmempoolaccept( | testres = self.nodes[2].testmempoolaccept( | ||||
Show All 14 Lines | def run_test(self): | ||||
outputs = {self.nodes[0].getnewaddress(): Decimal("0.98000000")} | outputs = {self.nodes[0].getnewaddress(): Decimal("0.98000000")} | ||||
rawTx = self.nodes[2].createrawtransaction(inputs, outputs) | rawTx = self.nodes[2].createrawtransaction(inputs, outputs) | ||||
rawTxSigned = self.nodes[2].signrawtransactionwithwallet(rawTx) | rawTxSigned = self.nodes[2].signrawtransactionwithwallet(rawTx) | ||||
assert_equal(rawTxSigned['complete'], True) | assert_equal(rawTxSigned['complete'], True) | ||||
# Fee 2,000,000 satoshis, ~100 b transaction, fee rate should land around 20,000 sat/byte = 0.20000000 BCH/kB | # Fee 2,000,000 satoshis, ~100 b transaction, fee rate should land around 20,000 sat/byte = 0.20000000 BCH/kB | ||||
# Thus, testmempoolaccept should reject | # Thus, testmempoolaccept should reject | ||||
testres = self.nodes[2].testmempoolaccept([rawTxSigned['hex']])[0] | testres = self.nodes[2].testmempoolaccept([rawTxSigned['hex']])[0] | ||||
assert_equal(testres['allowed'], False) | assert_equal(testres['allowed'], False) | ||||
assert_equal(testres['reject-reason'], '256: absurdly-high-fee') | assert_equal(testres['reject-reason'], 'absurdly-high-fee') | ||||
# and sendrawtransaction should throw | # and sendrawtransaction should throw | ||||
assert_raises_rpc_error(-26, | assert_raises_rpc_error(-26, | ||||
"absurdly-high-fee", | "absurdly-high-fee", | ||||
self.nodes[2].sendrawtransaction, | self.nodes[2].sendrawtransaction, | ||||
rawTxSigned['hex']) | rawTxSigned['hex']) | ||||
# and the following calls should both succeed | # and the following calls should both succeed | ||||
testres = self.nodes[2].testmempoolaccept( | testres = self.nodes[2].testmempoolaccept( | ||||
rawtxs=[rawTxSigned['hex']], maxfeerate='0.20000000')[0] | rawtxs=[rawTxSigned['hex']], maxfeerate='0.20000000')[0] | ||||
Show All 32 Lines |