Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
duniter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
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
nodes
typescript
duniter
Commits
8903cadc
Commit
8903cadc
authored
3 years ago
by
Cédric Moreau
Browse files
Options
Downloads
Plain Diff
Merge branch 'hotfix/tx-comment-uses-keywords' into release/1.8
parents
53af8359
de139603
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!1406
Hotfix/tx comment uses keywords
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/lib/common-libs/parsers/block.ts
+8
-8
8 additions, 8 deletions
app/lib/common-libs/parsers/block.ts
test/fast/misc/block-format-keywords.ts
+94
-0
94 additions, 0 deletions
test/fast/misc/block-format-keywords.ts
with
102 additions
and
8 deletions
app/lib/common-libs/parsers/block.ts
+
8
−
8
View file @
8903cadc
...
@@ -49,42 +49,42 @@ export class BlockParser extends GenericParser {
...
@@ -49,42 +49,42 @@ export class BlockParser extends GenericParser {
{
prop
:
"
membersCount
"
,
regexp
:
CommonConstants
.
BLOCK
.
MEMBERS_COUNT
},
{
prop
:
"
membersCount
"
,
regexp
:
CommonConstants
.
BLOCK
.
MEMBERS_COUNT
},
{
{
prop
:
"
identities
"
,
prop
:
"
identities
"
,
regexp
:
/Identities:
\n([\s\S]
*
)
Joiners/
,
regexp
:
/Identities:
\n([\s\S]
*
?
)
Joiners/
,
parser
:
splitAndMatch
(
"
\n
"
,
CommonConstants
.
IDENTITY
.
INLINE
),
parser
:
splitAndMatch
(
"
\n
"
,
CommonConstants
.
IDENTITY
.
INLINE
),
},
},
{
{
prop
:
"
joiners
"
,
prop
:
"
joiners
"
,
regexp
:
/Joiners:
\n([\s\S]
*
)
Actives/
,
regexp
:
/Joiners:
\n([\s\S]
*
?
)
Actives/
,
parser
:
splitAndMatch
(
"
\n
"
,
CommonConstants
.
BLOCK
.
JOINER
),
parser
:
splitAndMatch
(
"
\n
"
,
CommonConstants
.
BLOCK
.
JOINER
),
},
},
{
{
prop
:
"
actives
"
,
prop
:
"
actives
"
,
regexp
:
/Actives:
\n([\s\S]
*
)
Leavers/
,
regexp
:
/Actives:
\n([\s\S]
*
?
)
Leavers/
,
parser
:
splitAndMatch
(
"
\n
"
,
CommonConstants
.
BLOCK
.
ACTIVE
),
parser
:
splitAndMatch
(
"
\n
"
,
CommonConstants
.
BLOCK
.
ACTIVE
),
},
},
{
{
prop
:
"
leavers
"
,
prop
:
"
leavers
"
,
regexp
:
/Leavers:
\n([\s\S]
*
)
Excluded/
,
regexp
:
/Leavers:
\n([\s\S]
*
?
)
Excluded/
,
parser
:
splitAndMatch
(
"
\n
"
,
CommonConstants
.
BLOCK
.
LEAVER
),
parser
:
splitAndMatch
(
"
\n
"
,
CommonConstants
.
BLOCK
.
LEAVER
),
},
},
{
{
prop
:
"
revoked
"
,
prop
:
"
revoked
"
,
regexp
:
/Revoked:
\n([\s\S]
*
)
Excluded/
,
regexp
:
/Revoked:
\n([\s\S]
*
?
)
Excluded/
,
parser
:
splitAndMatch
(
"
\n
"
,
CommonConstants
.
BLOCK
.
REVOCATION
),
parser
:
splitAndMatch
(
"
\n
"
,
CommonConstants
.
BLOCK
.
REVOCATION
),
},
},
{
{
prop
:
"
excluded
"
,
prop
:
"
excluded
"
,
regexp
:
/Excluded:
\n([\s\S]
*
)
Certifications/
,
regexp
:
/Excluded:
\n([\s\S]
*
?
)
Certifications/
,
parser
:
splitAndMatch
(
"
\n
"
,
CommonConstants
.
PUBLIC_KEY
),
parser
:
splitAndMatch
(
"
\n
"
,
CommonConstants
.
PUBLIC_KEY
),
},
},
{
{
prop
:
"
certifications
"
,
prop
:
"
certifications
"
,
regexp
:
/Certifications:
\n([\s\S]
*
)
Transactions/
,
regexp
:
/Certifications:
\n([\s\S]
*
?
)
Transactions/
,
parser
:
splitAndMatch
(
"
\n
"
,
CommonConstants
.
CERT
.
OTHER
.
INLINE
),
parser
:
splitAndMatch
(
"
\n
"
,
CommonConstants
.
CERT
.
OTHER
.
INLINE
),
},
},
{
{
prop
:
"
transactions
"
,
prop
:
"
transactions
"
,
regexp
:
/Transactions:
\n([\s\S]
*
)
/
,
regexp
:
/Transactions:
\n([\s\S]
*
)
/
,
// No need for greedy "?" regexp capture, "Transaction" parsing is different from previous multiline fields
parser
:
extractTransactions
,
parser
:
extractTransactions
,
},
},
{
prop
:
"
inner_hash
"
,
regexp
:
CommonConstants
.
BLOCK
.
INNER_HASH
},
{
prop
:
"
inner_hash
"
,
regexp
:
CommonConstants
.
BLOCK
.
INNER_HASH
},
...
...
This diff is collapsed.
Click to expand it.
test/fast/misc/block-format-keywords.ts
0 → 100644
+
94
−
0
View file @
8903cadc
// Source file from duniter: Crypto-currency software to manage libre currency such as Ğ1
// Copyright (C) 2018 Cedric Moreau <cem.moreau@gmail.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
import
{
parsers
}
from
"
../../../app/lib/common-libs/parsers/index
"
const
should
=
require
(
'
should
'
);
const
raw
=
"
Version: 12
\n
"
+
"
Type: Block
\n
"
+
"
Currency: g1
\n
"
+
"
Number: 514924
\n
"
+
"
PoWMin: 107
\n
"
+
"
Time: 1649350123
\n
"
+
"
MedianTime: 1649341555
\n
"
+
"
UnitBase: 0
\n
"
+
"
Issuer: 6v9zutCfuihSBfu2wb7LSybtJwSFV3AhHv9EVAUL9mzc
\n
"
+
"
IssuersFrame: 132
\n
"
+
"
IssuersFrameVar: 9
\n
"
+
"
DifferentIssuersCount: 28
\n
"
+
"
PreviousHash: 0000003C52412C5E1A3F5623D450F6FDE33EFEABD9394564DBF3415106F11326
\n
"
+
"
PreviousIssuer: VxCoqfTQRaPaiAc1Am2Z7gtbN2LaNm6RV19Ycfb8dFL
\n
"
+
"
MembersCount: 4845
\n
"
+
"
Identities:
\n
"
+
"
Joiners:
\n
"
+
"
Actives:
\n
"
+
"
Leavers:
\n
"
+
"
D68EcHtiDh1LF74TaNhmZd9R242L8xUbCREM6PS36F3H:iwy6N+IVc0bCqu7JqALzfEFWAaaJO1oj0d8ZaHQlOePl3UV4RHZb2XmMB8hALeVUK2B0+FzVWAogxnpDApcYCw==:514916-000000063FBB37691C2E06EAAF3D99D3457AD2354B0D0BBDD077FB6EE6397AFA:278989-000000B80F3A716C7AC4BC70333DB3F5FE94139A1BC678ED3795DF7CE029D82E:lauhhann
\n
"
+
"
Revoked:
\n
"
+
"
Excluded:
\n
"
+
"
Certifications:
\n
"
+
"
EpgZeL9Pts68uhZQ5Z6CHCHjfyiysqQULtvtXXJVPg2:DTgQ97AuJ8UgVXcxmNtULAs8Fg1kKC1Wr9SAS96Br9NG:514917:hZDIY1Gmo/2SANCj5rzVEdSJcBQk0srOLomlvtLv7SlOojWJ/k/dQI0EXG2U7lVTGcbcSpHhVdO6MKgVs7vWAA==
\n
"
+
"
78iKYpug8JXRCwaeE7GK9gZLB8BqJkdCKMh1FJugBT5x:AruGq9VwaG4AVPthsmSekHjr6S3HfLgCz3NbvnhGoGi:514917:QK30J6Z7X0OK3kI46avmJrDiOtGcFbA+iFVpRLZXdFsSc3nGOoWSra22ACCCKTBbxUPYL854SAYLh0DUs+ZnBg==
\n
"
+
"
AFv1D5xA7FCdHCTA1bqfQ3PWvwEM16Gw67QJ37obGnsv:5seBQtApt43EoVjRR8eTJaDtg8x8sMXWX3KjGsuJjNnV:514917:+QISXljj1yWu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514918-000000342C2240AB86C669326D723A0B8421840FF909076F5739F7FD59B31709
\n
"
+
"
HCV6HP1goDQjnwDXUGrDAaiJDiChtsL1RmVBBLxapq94
\n
"
+
"
1042:0:D:HCV6HP1goDQjnwDXUGrDAaiJDiChtsL1RmVBBLxapq94:503508
\n
"
+
"
1042:0:D:HCV6HP1goDQjnwDXUGrDAaiJDiChtsL1RmVBBLxapq94:503799
\n
"
+
"
1042:0:D:HCV6HP1goDQjnwDXUGrDAaiJDiChtsL1RmVBBLxapq94:504076
\n
"
+
"
1042:0:D:HCV6HP1goDQjnwDXUGrDAaiJDiChtsL1RmVBBLxapq94:504350
\n
"
+
"
1042:0:D:HCV6HP1goDQjnwDXUGrDAaiJDiChtsL1RmVBBLxapq94:504615
\n
"
+
"
0:SIG(0)
\n
"
+
"
1:SIG(0)
\n
"
+
"
2:SIG(0)
\n
"
+
"
3:SIG(0)
\n
"
+
"
4:SIG(0)
\n
"
+
"
5000:0:SIG(DvB8gAiL78cXZPHKfza2TR9xCxiCJiAbpzoCSkVhSd9e)
\n
"
+
"
210:0:SIG(HCV6HP1goDQjnwDXUGrDAaiJDiChtsL1RmVBBLxapq94)
\n
"
+
"
PAF Certifications
\n
"
+
"
OMmFGkqGp2BjchdiW2DOC5Wtc5G6NisY9aOL8lFX6f86ks0ptOun9/ec9sQJmtw7v/z37Iuug3gvax53tEXQAQ==
\n
"
+
"
InnerHash: A997D800B6A2D1D2098EC48D73DAB87AADADCE2C29D930A010EC341DE4D44215
\n
"
+
"
Nonce: 10200000000001
\n
"
+
"
TFYwQL+WphWuZ4ue08WaEeKWsPmonEa0VpiIuCsvz9TcfHS4bZ4J15Upgj5gv9IUzFPrch4d6bEezPxit9ZyAw==
\n
"
;
describe
(
"
Block reserved keywords
"
,
()
=>
{
const
parser
=
parsers
.
parseBlock
;
it
(
'
should be accepted
'
,
()
=>
parser
.
syncWrite
(
raw
))
});
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