(self, rbf_node, dest_address)
| 321 | |
| 322 | |
| 323 | def test_dust_to_fee(self, rbf_node, dest_address): |
| 324 | self.log.info('Test that bumped output that is dust is dropped to fee') |
| 325 | rbfid = spend_one_input(rbf_node, dest_address) |
| 326 | fulltx = rbf_node.getrawtransaction(rbfid, 1) |
| 327 | # The DER formatting used by Bitcoin to serialize ECDSA signatures means that signatures can have a |
| 328 | # variable size of 70-72 bytes (or possibly even less), with most being 71 or 72 bytes. The signature |
| 329 | # in the witness is divided by 4 for the vsize, so this variance can take the weight across a 4-byte |
| 330 | # boundary |
| 331 | # ELEMENTS: 116 vbytes added (9 for fee spk+value, 99 for assets, 3 for value tags, 3 for null nonces, 2 for elements tx encoding) |
| 332 | # size of transaction (p2wpkh, 1 input, 3 outputs): 257 vbytes |
| 333 | if not 140 + 116 <= fulltx["vsize"] <= 141 + 116: |
| 334 | raise AssertionError("Invalid tx vsize of {} (256-257 expected), full tx: {}".format(fulltx["vsize"], fulltx)) |
| 335 | # Bump with fee_rate of 350.25 sat/vB vbytes to create dust. |
| 336 | # ELEMENTS: Expected bump fee of 257 vbytes * fee_rate 0.00190000 BTC / 1000 vbytes = 0.00048830 BTC |
| 337 | # Expected fee is 141 vbytes * fee_rate 0.00350250 BTC / 1000 vbytes = 0.00049385 BTC. |
| 338 | # or occasionally 140 vbytes * fee_rate 0.00350250 BTC / 1000 vbytes = 0.00049035 BTC. |
| 339 | # Dust should be dropped to the fee, so actual bump fee is 0.00050000 BTC. |
| 340 | bumped_tx = rbf_node.bumpfee(rbfid, {"fee_rate": 190.00}) |
| 341 | full_bumped_tx = rbf_node.getrawtransaction(bumped_tx["txid"], 1) |
| 342 | assert_equal(bumped_tx["fee"], Decimal("0.00050000")) |
| 343 | assert_equal(len(fulltx["vout"]), 3) |
| 344 | assert_equal(len(full_bumped_tx["vout"]), 2) #change output is eliminated |
| 345 | assert_equal(full_bumped_tx["vout"][0]['value'], Decimal("0.00050000")) |
| 346 | self.clear_mempool() |
| 347 | |
| 348 | |
| 349 | def test_settxfee(self, rbf_node, dest_address): |
no test coverage detected