Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DuniterPy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
python
DuniterPy
Commits
e54fd1fe
Commit
e54fd1fe
authored
5 years ago
by
Moul
Browse files
Options
Downloads
Patches
Plain Diff
[test]
#113
: Add test for block signature verification
parent
792b1016
Branches
Branches containing commit
No related tags found
2 merge requests
!94
Merge dev into master for release 0.56.0
,
!89
#113 Implement block signature verification
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/key/test_verifying_key.py
+33
-0
33 additions, 0 deletions
tests/key/test_verifying_key.py
with
33 additions
and
0 deletions
tests/key/test_verifying_key.py
+
33
−
0
View file @
e54fd1fe
...
@@ -2,6 +2,7 @@ from duniterpy.key import VerifyingKey, SigningKey
...
@@ -2,6 +2,7 @@ from duniterpy.key import VerifyingKey, SigningKey
from
duniterpy.key.scrypt_params
import
ScryptParams
from
duniterpy.key.scrypt_params
import
ScryptParams
from
duniterpy.documents.peer
import
Peer
from
duniterpy.documents.peer
import
Peer
from
duniterpy.documents.ws2p.heads
import
HeadV0
,
HeadV1
,
HeadV2
from
duniterpy.documents.ws2p.heads
import
HeadV0
,
HeadV1
,
HeadV2
from
duniterpy.documents
import
Block
import
unittest
import
unittest
...
@@ -76,3 +77,35 @@ BASIC_MERKLED_API testnet.duniter.inso.ovh 80
...
@@ -76,3 +77,35 @@ BASIC_MERKLED_API testnet.duniter.inso.ovh 80
verifying_key
=
VerifyingKey
(
headv2
.
pubkey
)
verifying_key
=
VerifyingKey
(
headv2
.
pubkey
)
self
.
assertTrue
(
verifying_key
.
verify_ws2p_head
(
headv2
))
self
.
assertTrue
(
verifying_key
.
verify_ws2p_head
(
headv2
))
def
test_block_document
(
self
):
block_document
=
"""
Version: 10
Type: Block
Currency: g1
Number: 15145
PoWMin: 80
Time: 1493684276
MedianTime: 1493681245
UnitBase: 0
Issuer: 6fFt4zdvtNyVcfJn7Y41mKLmMDizyK3nVeNW3qdDXzpc
IssuersFrame: 106
IssuersFrameVar: 0
DifferentIssuersCount: 21
PreviousHash: 00000A0CE0AE54F3F6B63383F386067160C477B5338FB93AF3AF0776A959AA32
PreviousIssuer: D9D2zaJoWYWveii1JRYLVK3J4Z7ZH3QczoKrnQeiM6mx
MembersCount: 98
Identities:
Joiners:
Actives:
Leavers:
Revoked:
Excluded:
Certifications:
Transactions:
InnerHash: AA01ABD5C6D3F99A189C0CF0E37768DA0F876526AF93FE150E92B135D4AD0D85
Nonce: 10300000099432
"""
block_signature
=
"
Uxa3L+/m/dWLex2xSh7Jv1beAn4f99BmoYAs7iX3Lr+t1l5jzJpd9m4iI1cHppIizCgbg6ztaiZedQ+Mp6KuDg==
"
block
=
Block
.
from_signed_raw
(
block_document
+
block_signature
+
"
\n
"
)
verifying_key
=
VerifyingKey
(
block
.
issuer
)
self
.
assertTrue
(
verifying_key
.
verify_document
(
block
))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment