Port PR93 from @denioD

This commit is contained in:
Duke Leto
2020-03-07 13:55:12 -05:00
parent 21ec2e7260
commit a2b3316664
18 changed files with 186 additions and 106 deletions

View File

@@ -54,6 +54,7 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
spends2_id = [ self.nodes[0].sendrawtransaction(tx) for tx in spends2_raw ]
blocks.extend(self.nodes[0].generate(1))
self.sync_all()
# mempool should be empty, all txns confirmed
assert_equal(set(self.nodes[0].getrawmempool()), set())
@@ -74,6 +75,8 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
# Generate another block, they should all get mined
self.nodes[0].generate(1)
self.sync_all()
# mempool should be empty, all txns confirmed
assert_equal(set(self.nodes[0].getrawmempool()), set())
for txid in spends1_id+spends2_id:

View File

@@ -60,6 +60,14 @@ def sync_blocks(rpc_connections, wait=1):
break
time.sleep(wait)
# Now that the block counts are in sync, wait for the internal
# notifications to finish
while True:
notified = [ x.getblockchaininfo()['fullyNotified'] for x in rpc_connections ]
if notified == [ True ] * len(notified):
break
time.sleep(wait)
def sync_mempools(rpc_connections, wait=1):
"""
Wait until everybody has the same transactions in their memory

View File

@@ -31,6 +31,7 @@ class WalletTest (BitcoinTestFramework):
print "Mining blocks..."
self.nodes[0].generate(4)
self.sync_all()
walletinfo = self.nodes[0].getwalletinfo()
assert_equal(walletinfo['immature_balance'], 40)

View File

@@ -45,6 +45,7 @@ class Wallet1941RegressionTest (BitcoinTestFramework):
self.nodes[0].setmocktime(starttime)
self.nodes[0].generate(101)
self.sync_all()
mytaddr = self.nodes[0].getnewaddress() # where coins were mined
myzaddr = self.nodes[0].z_getnewaddress()
@@ -63,6 +64,7 @@ class Wallet1941RegressionTest (BitcoinTestFramework):
self.nodes[0].generate(1)
self.nodes[0].setmocktime(starttime + 9000)
self.nodes[0].generate(1)
self.sync_all()
# Confirm the balance on node 0.
resp = self.nodes[0].z_getbalance(myzaddr)

View File

@@ -27,6 +27,7 @@ class WalletAnchorForkTest (BitcoinTestFramework):
def run_test (self):
print "Mining blocks..."
self.nodes[0].generate(4)
self.sync_all()
walletinfo = self.nodes[0].getwalletinfo()
assert_equal(walletinfo['immature_balance'], 40)

View File

@@ -44,6 +44,7 @@ class WalletShieldCoinbaseTest (BitcoinTestFramework):
print "Mining blocks..."
self.nodes[0].generate(1)
self.sync_all()
do_not_shield_taddr = self.nodes[0].getnewaddress()
self.nodes[0].generate(4)

View File

@@ -30,6 +30,7 @@ class JoinSplitTest(BitcoinTestFramework):
protect_tx = self.nodes[0].signrawtransaction(joinsplit_result["rawtxn"])
self.nodes[0].sendrawtransaction(protect_tx["hex"])
self.nodes[0].generate(1)
self.sync_all()
receive_result = self.nodes[0].zcrawreceive(zcsecretkey, joinsplit_result["encryptednote1"])
assert_equal(receive_result["exists"], True)
@@ -39,6 +40,7 @@ class JoinSplitTest(BitcoinTestFramework):
addrtest = self.nodes[0].getnewaddress()
for xx in range(0,10):
self.nodes[0].generate(1)
self.sync_all()
for x in range(0,50):
self.nodes[0].sendtoaddress(addrtest, 0.01);
@@ -47,6 +49,7 @@ class JoinSplitTest(BitcoinTestFramework):
self.nodes[0].sendrawtransaction(joinsplit_result["rawtxn"])
self.nodes[0].generate(1)
self.sync_all()
print "Done!"
receive_result = self.nodes[0].zcrawreceive(zcsecretkey, joinsplit_result["encryptednote1"])

View File

@@ -37,15 +37,6 @@ class ZMQTest(BitcoinTestFramework):
self.sync_all()
print "listen..."
msg = self.zmqSubSocket.recv_multipart()
topic = msg[0]
assert_equal(topic, b"hashtx")
body = msg[1]
nseq = msg[2]
[nseq] # hush pyflakes
msgSequence = struct.unpack('<I', msg[-1])[-1]
assert_equal(msgSequence, 0) # must be sequence 0 on hashtx
msg = self.zmqSubSocket.recv_multipart()
topic = msg[0]
body = msg[1]
@@ -55,6 +46,15 @@ class ZMQTest(BitcoinTestFramework):
assert_equal(genhashes[0], blkhash) #blockhash from generate must be equal to the hash received over zmq
msg = self.zmqSubSocket.recv_multipart()
topic = msg[0]
assert_equal(topic, b"hashtx")
body = msg[1]
nseq = msg[2]
[nseq] # hush pyflakes
msgSequence = struct.unpack('<I', msg[-1])[-1]
assert_equal(msgSequence, 0) # must be sequence 0 on hashtx
n = 10
genhashes = self.nodes[1].generate(n)
self.sync_all()