mirror of
https://github.com/libp2p/go-libp2p-core.git
synced 2025-01-14 02:20:06 +08:00
Revert "return buffer to pool before early return"
8d8da386f2
misread this - unsigned will be nil if there's an
error, so it was right the way it was
This commit is contained in:
parent
7ee4611788
commit
3c208b0d26
@ -65,10 +65,10 @@ func MakeEnvelope(privateKey crypto.PrivKey, domain string, payloadType []byte,
|
||||
|
||||
seq := statelessSeqNo()
|
||||
unsigned, err := makeUnsigned(domain, payloadType, payload, seq)
|
||||
defer pool.Put(unsigned)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer pool.Put(unsigned)
|
||||
|
||||
sig, err := privateKey.Sign(unsigned)
|
||||
if err != nil {
|
||||
@ -226,10 +226,10 @@ func (e *Envelope) TypedRecord(dest Record) error {
|
||||
// or an error if signature validation fails.
|
||||
func (e *Envelope) validate(domain string) error {
|
||||
unsigned, err := makeUnsigned(domain, e.PayloadType, e.RawPayload, e.Seq)
|
||||
defer pool.Put(unsigned)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer pool.Put(unsigned)
|
||||
|
||||
valid, err := e.PublicKey.Verify(unsigned, e.signature)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user