Skip to content

Commit

Permalink
Auto merge of zcash#2698 - bitcartel:2263_fix_broken_pipe, r=str4d
Browse files Browse the repository at this point in the history
Fix broken pipe error on some platforms when running qa test wallet_protectcoinbase.py

Closes zcash#2263.
  • Loading branch information
zkbot committed Oct 31, 2017
2 parents fbd5965 + cf72e8e commit 08c91f4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions qa/rpc-tests/wallet_protectcoinbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import sys
import time
import timeit
from decimal import Decimal

class WalletProtectCoinbaseTest (BitcoinTestFramework):
Expand Down Expand Up @@ -244,9 +245,22 @@ def run_test (self):
amount_per_recipient = Decimal('0.00000546') # dust threshold
# Note that regtest chainparams does not require standard tx, so setting the amount to be
# less than the dust threshold, e.g. 0.00000001 will not result in mempool rejection.
start_time = timeit.default_timer()
for i in xrange(0,num_t_recipients):
newtaddr = self.nodes[2].getnewaddress()
recipients.append({"address":newtaddr, "amount":amount_per_recipient})
elapsed = timeit.default_timer() - start_time
print("...invoked getnewaddress() {} times in {} seconds".format(num_t_recipients, elapsed))

# Issue #2263 Workaround START
# HTTP connection to node 0 may fall into a state, during the few minutes it takes to process
# loop above to create new addresses, that when z_sendmany is called with a large amount of
# rpc data in recipients, the connection fails with a 'broken pipe' error. Making a RPC call
# to node 0 before calling z_sendmany appears to fix this issue, perhaps putting the HTTP
# connection into a good state to handle a large amount of data in recipients.
self.nodes[0].getinfo()
# Issue #2263 Workaround END

myopid = self.nodes[0].z_sendmany(myzaddr, recipients)
try:
self.wait_and_assert_operationid_status(myopid)
Expand Down

0 comments on commit 08c91f4

Please sign in to comment.