mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-27 23:34:20 +00:00
Litecoin: Fix wallet_abandonconflict test
This commit is contained in:
parent
ad3c330972
commit
ccf37a45fe
@ -47,20 +47,20 @@ class AbandonConflictTest(BitcoinTestFramework):
|
|||||||
inputs.append({"txid":txB, "vout":nB})
|
inputs.append({"txid":txB, "vout":nB})
|
||||||
outputs = {}
|
outputs = {}
|
||||||
|
|
||||||
outputs[self.nodes[0].getnewaddress()] = Decimal("14.998")
|
outputs[self.nodes[0].getnewaddress()] = Decimal("14.99998")
|
||||||
outputs[self.nodes[1].getnewaddress()] = Decimal("5")
|
outputs[self.nodes[1].getnewaddress()] = Decimal("5")
|
||||||
signed = self.nodes[0].signrawtransaction(self.nodes[0].createrawtransaction(inputs, outputs))
|
signed = self.nodes[0].signrawtransaction(self.nodes[0].createrawtransaction(inputs, outputs))
|
||||||
txAB1 = self.nodes[0].sendrawtransaction(signed["hex"])
|
txAB1 = self.nodes[0].sendrawtransaction(signed["hex"])
|
||||||
|
|
||||||
# Identify the 14.99998btc output
|
# Identify the 14.99998btc output
|
||||||
nAB = next(i for i, vout in enumerate(self.nodes[0].getrawtransaction(txAB1, 1)["vout"]) if vout["value"] == Decimal("14.998"))
|
nAB = next(i for i, vout in enumerate(self.nodes[0].getrawtransaction(txAB1, 1)["vout"]) if vout["value"] == Decimal("14.99998"))
|
||||||
|
|
||||||
#Create a child tx spending AB1 and C
|
#Create a child tx spending AB1 and C
|
||||||
inputs = []
|
inputs = []
|
||||||
inputs.append({"txid":txAB1, "vout":nAB})
|
inputs.append({"txid":txAB1, "vout":nAB})
|
||||||
inputs.append({"txid":txC, "vout":nC})
|
inputs.append({"txid":txC, "vout":nC})
|
||||||
outputs = {}
|
outputs = {}
|
||||||
outputs[self.nodes[0].getnewaddress()] = Decimal("24.96")
|
outputs[self.nodes[0].getnewaddress()] = Decimal("24.9996")
|
||||||
signed2 = self.nodes[0].signrawtransaction(self.nodes[0].createrawtransaction(inputs, outputs))
|
signed2 = self.nodes[0].signrawtransaction(self.nodes[0].createrawtransaction(inputs, outputs))
|
||||||
txABC2 = self.nodes[0].sendrawtransaction(signed2["hex"])
|
txABC2 = self.nodes[0].sendrawtransaction(signed2["hex"])
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ class AbandonConflictTest(BitcoinTestFramework):
|
|||||||
# Restart the node with a higher min relay fee so the parent tx is no longer in mempool
|
# Restart the node with a higher min relay fee so the parent tx is no longer in mempool
|
||||||
# TODO: redo with eviction
|
# TODO: redo with eviction
|
||||||
self.stop_node(0)
|
self.stop_node(0)
|
||||||
self.start_node(0, extra_args=["-minrelaytxfee=0.01"])
|
self.start_node(0, extra_args=["-minrelaytxfee=0.0001"])
|
||||||
|
|
||||||
# Verify txs no longer in either node's mempool
|
# Verify txs no longer in either node's mempool
|
||||||
assert_equal(len(self.nodes[0].getrawmempool()), 0)
|
assert_equal(len(self.nodes[0].getrawmempool()), 0)
|
||||||
@ -107,7 +107,7 @@ class AbandonConflictTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
# Verify that even with a low min relay fee, the tx is not reaccepted from wallet on startup once abandoned
|
# Verify that even with a low min relay fee, the tx is not reaccepted from wallet on startup once abandoned
|
||||||
self.stop_node(0)
|
self.stop_node(0)
|
||||||
self.start_node(0, extra_args=["-minrelaytxfee=0.001"])
|
self.start_node(0, extra_args=["-minrelaytxfee=0.00001"])
|
||||||
assert_equal(len(self.nodes[0].getrawmempool()), 0)
|
assert_equal(len(self.nodes[0].getrawmempool()), 0)
|
||||||
assert_equal(self.nodes[0].getbalance(), balance)
|
assert_equal(self.nodes[0].getbalance(), balance)
|
||||||
|
|
||||||
@ -116,21 +116,21 @@ class AbandonConflictTest(BitcoinTestFramework):
|
|||||||
# But its child tx remains abandoned
|
# But its child tx remains abandoned
|
||||||
self.nodes[0].sendrawtransaction(signed["hex"])
|
self.nodes[0].sendrawtransaction(signed["hex"])
|
||||||
newbalance = self.nodes[0].getbalance()
|
newbalance = self.nodes[0].getbalance()
|
||||||
assert_equal(newbalance, balance - Decimal("20") + Decimal("14.998"))
|
assert_equal(newbalance, balance - Decimal("20") + Decimal("14.99998"))
|
||||||
balance = newbalance
|
balance = newbalance
|
||||||
|
|
||||||
# Send child tx again so its unabandoned
|
# Send child tx again so its unabandoned
|
||||||
self.nodes[0].sendrawtransaction(signed2["hex"])
|
self.nodes[0].sendrawtransaction(signed2["hex"])
|
||||||
newbalance = self.nodes[0].getbalance()
|
newbalance = self.nodes[0].getbalance()
|
||||||
assert_equal(newbalance, balance - Decimal("10") - Decimal("14.998") + Decimal("24.96"))
|
assert_equal(newbalance, balance - Decimal("10") - Decimal("14.99998") + Decimal("24.9996"))
|
||||||
balance = newbalance
|
balance = newbalance
|
||||||
|
|
||||||
# Remove using high relay fee again
|
# Remove using high relay fee again
|
||||||
self.stop_node(0)
|
self.stop_node(0)
|
||||||
self.start_node(0, extra_args=["-minrelaytxfee=0.01"])
|
self.start_node(0, extra_args=["-minrelaytxfee=0.0001"])
|
||||||
assert_equal(len(self.nodes[0].getrawmempool()), 0)
|
assert_equal(len(self.nodes[0].getrawmempool()), 0)
|
||||||
newbalance = self.nodes[0].getbalance()
|
newbalance = self.nodes[0].getbalance()
|
||||||
assert_equal(newbalance, balance - Decimal("24.96"))
|
assert_equal(newbalance, balance - Decimal("24.9996"))
|
||||||
balance = newbalance
|
balance = newbalance
|
||||||
|
|
||||||
# Create a double spend of AB1 by spending again from only A's 10 output
|
# Create a double spend of AB1 by spending again from only A's 10 output
|
||||||
@ -138,7 +138,7 @@ class AbandonConflictTest(BitcoinTestFramework):
|
|||||||
inputs =[]
|
inputs =[]
|
||||||
inputs.append({"txid":txA, "vout":nA})
|
inputs.append({"txid":txA, "vout":nA})
|
||||||
outputs = {}
|
outputs = {}
|
||||||
outputs[self.nodes[1].getnewaddress()] = Decimal("9.99")
|
outputs[self.nodes[1].getnewaddress()] = Decimal("9.9999")
|
||||||
tx = self.nodes[0].createrawtransaction(inputs, outputs)
|
tx = self.nodes[0].createrawtransaction(inputs, outputs)
|
||||||
signed = self.nodes[0].signrawtransaction(tx)
|
signed = self.nodes[0].signrawtransaction(tx)
|
||||||
self.nodes[1].sendrawtransaction(signed["hex"])
|
self.nodes[1].sendrawtransaction(signed["hex"])
|
||||||
@ -163,4 +163,4 @@ class AbandonConflictTest(BitcoinTestFramework):
|
|||||||
self.log.info(str(balance) + " -> " + str(newbalance) + " ?")
|
self.log.info(str(balance) + " -> " + str(newbalance) + " ?")
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
AbandonConflictTest().main()
|
AbandonConflictTest().main()
|
Loading…
x
Reference in New Issue
Block a user