-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[INDY-1137] Making proof possible for given root hash (#575)
* [INDY-1137] Making proof possible for given root hash Signed-off-by: Andrew Nikitin <[email protected]> * [INDY-1137] Change make_proof Signed-off-by: Andrew Nikitin <[email protected]> * [INDY-1137] Added test for make_proof Signed-off-by: Andrew Nikitin <[email protected]>
- Loading branch information
1 parent
0b8d0cb
commit 96b21b2
Showing
3 changed files
with
29 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from base58 import b58encode | ||
from plenum.test.pool_transactions.conftest import looper | ||
from plenum.test.helper import sdk_send_random_and_check | ||
from plenum.common.types import f | ||
from plenum.common.constants import ROOT_HASH | ||
|
||
|
||
def test_make_proof(looper, sdk_wallet_steward, sdk_pool_handle, txnPoolNodeSet): | ||
node = txnPoolNodeSet[0] | ||
req_handler = node.getDomainReqHandler() | ||
req1, _ = sdk_send_random_and_check(looper, txnPoolNodeSet, sdk_pool_handle, sdk_wallet_steward, 1)[0] | ||
# Save headHash after first request | ||
head1 = req_handler.state.headHash | ||
sdk_send_random_and_check(looper, txnPoolNodeSet, sdk_pool_handle, sdk_wallet_steward, 1) | ||
# Save headHash after second request | ||
head2 = req_handler.state.headHash | ||
# Build path to first request | ||
path1 = req_handler.prepare_buy_key(req1[f.IDENTIFIER.nm], req1[f.REQ_ID.nm]) | ||
# Check that if parameter "head_hash" is None, then we make proof for commitedHeadHash (by default) | ||
assert b58encode(head2) == req_handler.make_proof(path1)[ROOT_HASH] | ||
# Check that if parameter "head_hash" is not None, then we make proof for given headHash | ||
assert b58encode(head1) == req_handler.make_proof(path1, head_hash=head1)[ROOT_HASH] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters