Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various performance improvements and a 1.16 fix. [WIP] #251

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions blockchain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,7 @@ type BlockChain struct {
//
// unknownRulesWarned refers to warnings due to unknown rules being
// activated.
//
// unknownVersionsWarned refers to warnings due to unknown versions
// being mined.
unknownRulesWarned bool
unknownVersionsWarned bool

// The notifications field stores a slice of callbacks to be executed on
// certain blockchain events.
Expand Down Expand Up @@ -581,20 +577,14 @@ func (b *BlockChain) connectBlock(node *blockNode, block *btcutil.Block,
"spent transaction out information")
}

// No warnings about unknown rules or versions until the chain is
// No warnings about unknown rules until the chain is
// current.
if b.isCurrent() {
// Warn if any unknown new rules are either about to activate or
// have already been activated.
if err := b.warnUnknownRuleActivations(node); err != nil {
return err
}

// Warn if a high enough percentage of the last blocks have
// unexpected versions.
if err := b.warnUnknownVersions(node); err != nil {
return err
}
}

// Write any block status changes to DB before updating best state.
Expand Down
14 changes: 11 additions & 3 deletions blockchain/packetcrypt/cryptocycle/cryptocycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ package cryptocycle

import (
"encoding/binary"
"fmt"

"github.com/aead/chacha20/chacha"

"golang.org/x/crypto/curve25519"
"github.com/johnsonjh/goc25519sm"
"golang.org/x/crypto/poly1305"

"github.com/pkt-cash/pktd/blockchain/packetcrypt/randhash/interpret"
Expand Down Expand Up @@ -169,10 +170,17 @@ func Update(state *State, item []byte, contentBlock []byte, randHashCycles int,
// Smul does a scalar mult cycle
func Smul(s *State) {
var a, b, c [32]byte
var err error
copy(a[:], s.Bytes[32:][:32])
curve25519.ScalarBaseMult(&b, &a)
err = goc25519sm.OldScalarBaseMult(&b, &a)
if err != nil {
panic(fmt.Sprintf("CryptoCycle.goc25519sm.OldScalarBaseMult failure:\n %v", err))
}
copy(a[:], s.Bytes[:32])
curve25519.ScalarMult(&c, &a, &b)
err = goc25519sm.OldScalarMult(&c, &a, &b)
if err != nil {
panic(fmt.Sprintf("CryptoCycle.goc25519sm.OldScalarMult failure:\n %v", err))
}
copy(s.Bytes[64:][:32], c[:])
}

Expand Down
Loading