mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-07 23:10:32 +00:00
crypto/consensus: sign hashes and cache them for consensus payloads
Avoid serializing payload again and again for various purposes. To sign it, we only need a hash. Some 2.4% gain in TPS could be achieved with this.
This commit is contained in:
parent
49e9c1aa0f
commit
53c014a0bb
11 changed files with 119 additions and 42 deletions
|
@ -57,6 +57,8 @@ func TestRecoveryMessage_Setters(t *testing.T) {
|
|||
|
||||
ps := r.GetPrepareResponses(p, pubs)
|
||||
require.Len(t, ps, 1)
|
||||
// Update hashes and serialized data.
|
||||
_ = ps[0].Hash()
|
||||
require.Equal(t, p2, ps[0])
|
||||
ps0 := ps[0].(*Payload)
|
||||
require.True(t, srv.validatePayload(ps0))
|
||||
|
@ -91,6 +93,8 @@ func TestRecoveryMessage_Setters(t *testing.T) {
|
|||
|
||||
ps := r.GetChangeViews(p, pubs)
|
||||
require.Len(t, ps, 1)
|
||||
// update hashes and serialized data.
|
||||
_ = ps[0].Hash()
|
||||
require.Equal(t, p3, ps[0])
|
||||
|
||||
ps0 := ps[0].(*Payload)
|
||||
|
@ -109,6 +113,8 @@ func TestRecoveryMessage_Setters(t *testing.T) {
|
|||
|
||||
ps := r.GetCommits(p, pubs)
|
||||
require.Len(t, ps, 1)
|
||||
// update hashes and serialized data.
|
||||
_ = ps[0].Hash()
|
||||
require.Equal(t, p4, ps[0])
|
||||
|
||||
ps0 := ps[0].(*Payload)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue