mirror of https://github.com/status-im/nim-abc.git
Check validity of set of acknowledgements
This commit is contained in:
parent
db1d8d3ae8
commit
338f94b6c7
|
@ -47,3 +47,9 @@ func hasValidAck*(store: TxStore, ackHash: AckHash): bool =
|
|||
return false
|
||||
|
||||
true
|
||||
|
||||
func hasValidAcks*(store: TxStore, hashes: varargs[AckHash]): bool =
|
||||
for hash in hashes:
|
||||
if not store.hasValidAck(hash):
|
||||
return false
|
||||
true
|
||||
|
|
|
@ -107,3 +107,11 @@ suite "Acknowledgement validation":
|
|||
store.add(bad1, bad2)
|
||||
check not store.hasValidAck(bad1.hash)
|
||||
check not store.hasValidAck(bad2.hash)
|
||||
|
||||
test "checks validity of a set of acknowledgements":
|
||||
var store = TxStore.init(genesis)
|
||||
store.add(tx1, tx2)
|
||||
store.add(ack2)
|
||||
check not store.hasValidAcks(ack1.hash, ack2.hash)
|
||||
store.add(ack1)
|
||||
check store.hasValidAcks(ack1.hash, ack2.hash)
|
||||
|
|
Loading…
Reference in New Issue