Test the expiry height of migration transactions.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
Daira Hopwood 2019-05-10 13:48:24 +01:00
parent 14c0be6f27
commit e7529049fb
1 changed files with 12 additions and 1 deletions

View File

@ -102,14 +102,25 @@ class SproutSaplingMigration(BitcoinTestFramework):
self.sync_all()
# At 499 % 500 there will be a transaction in the mempool and the note will be locked
assert_equal(1, len(node.getrawmempool()), "mempool size at 499 % 500")
mempool = node.getrawmempool()
print("mempool: {}".format(mempool))
assert_equal(1, len(mempool), "mempool size at 499 % 500")
assert_equal(node.z_getbalance(sproutAddr), Decimal('0'))
assert_equal(node.z_getbalance(saplingAddr), Decimal('0'))
assert_true(node.z_getbalance(saplingAddr, 0) > Decimal('0'), "Unconfirmed sapling balance at 499 % 500")
# Check that unmigrated amount + unfinalized = starting balance - fee
status = node.z_getmigrationstatus()
print("status: {}".format(status))
assert_equal(Decimal('9.9999'), Decimal(status['unmigrated_amount']) + Decimal(status['unfinalized_migrated_amount']))
# The transaction in the mempool should be the one listed in migration_txids,
# and it should expire at the next 450 % 500.
assert_equal(1, len(status['migration_txids']))
txid = status['migration_txids'][0]
assert_equal(txid, mempool[0])
tx = node.getrawtransaction(txid, 1)
assert_equal(target_height + 450, tx['expiryheight'])
node.generate(1)
self.sync_all()