From c2403d4b2d0505d883249b7716aea87856888f73 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 24 Dec 2015 12:48:24 -0600 Subject: [PATCH] shachain: switch encode/decode methods to use io.Reader/Writer * Help avoid a bug related to passing a copy of bytes.Buffer into Encode/Decode instead of a pointer --- shachain/shachain.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shachain/shachain.go b/shachain/shachain.go index aafe5ebd..2111bd7e 100644 --- a/shachain/shachain.go +++ b/shachain/shachain.go @@ -5,6 +5,7 @@ import ( "crypto/rand" "crypto/sha256" "fmt" + "io" "sync" "github.com/btcsuite/btcd/wire" @@ -170,11 +171,11 @@ func (h *HyperShaChain) LocatePreImage(outputScript []byte) (uint64, *[32]byte) } // MarshallBinary... -func (h *HyperShaChain) Encode(b bytes.Buffer) error { +func (h *HyperShaChain) Encode(b io.Writer) error { return nil } // UnmarshallBinary... -func (h *HyperShaChain) Decode(b bytes.Buffer) error { +func (h *HyperShaChain) Decode(b io.Reader) error { return nil }