test: Add and use DashTestFramework.get_recovered_sig (#3801)

* test: Introduce DashTestFramework.get_recovered_sig

* test: Use DashTestFramework.get_recovered_sig
This commit is contained in:
dustinface 2020-11-09 22:58:49 +01:00 committed by GitHub
parent 038b31c796
commit 748d91dd7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 22 deletions

View File

@ -280,17 +280,7 @@ class LLMQ_IS_CL_Conflicts(DashTestFramework):
for mn in self.mninfo: for mn in self.mninfo:
mn.node.quorum('sign', 100, request_id, message_hash) mn.node.quorum('sign', 100, request_id, message_hash)
recSig = None recSig = self.get_recovered_sig(request_id, message_hash)
t = time.time()
while time.time() - t < 10:
try:
recSig = self.nodes[0].quorum('getrecsig', 100, request_id, message_hash)
break
except:
time.sleep(0.1)
assert(recSig is not None)
clsig = msg_clsig(height, blockHash, hex_str_to_bytes(recSig['sig'])) clsig = msg_clsig(height, blockHash, hex_str_to_bytes(recSig['sig']))
return clsig return clsig
@ -309,17 +299,7 @@ class LLMQ_IS_CL_Conflicts(DashTestFramework):
for mn in self.mninfo: for mn in self.mninfo:
mn.node.quorum('sign', 100, request_id, message_hash) mn.node.quorum('sign', 100, request_id, message_hash)
recSig = None recSig = self.get_recovered_sig(request_id, message_hash)
t = time.time()
while time.time() - t < 10:
try:
recSig = self.nodes[0].quorum('getrecsig', 100, request_id, message_hash)
break
except:
time.sleep(0.1)
assert(recSig is not None)
islock = msg_islock(inputs, tx.sha256, hex_str_to_bytes(recSig['sig'])) islock = msg_islock(inputs, tx.sha256, hex_str_to_bytes(recSig['sig']))
return islock return islock

View File

@ -977,6 +977,19 @@ class DashTestFramework(BitcoinTestFramework):
return new_quorum return new_quorum
def get_recovered_sig(self, rec_sig_id, rec_sig_msg_hash, llmq_type=100, node=None):
node = self.nodes[0] if node is None else node
rec_sig = None
time_start = time.time()
while time.time() - time_start < 10:
try:
rec_sig = node.quorum('getrecsig', llmq_type, rec_sig_id, rec_sig_msg_hash)
break
except JSONRPCException:
time.sleep(0.1)
assert(rec_sig is not None)
return rec_sig
def get_quorum_masternodes(self, q): def get_quorum_masternodes(self, q):
qi = self.nodes[0].quorum('info', 100, q) qi = self.nodes[0].quorum('info', 100, q)
result = [] result = []