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

Implmement BlockHeader BtcEncode/BtcDecode. #467

Merged
merged 1 commit into from
Jul 22, 2015
Merged

Implmement BlockHeader BtcEncode/BtcDecode. #467

merged 1 commit into from
Jul 22, 2015

Conversation

dajohi
Copy link
Member

@dajohi dajohi commented Jul 22, 2015

At the current time, there is no difference between the wire encoding
at protocol version 0 and the stable long-term storage format. These
methods are simply for consistency with the other types.

@@ -156,6 +156,81 @@ func TestBlockHeaderWire(t *testing.T) {
}
}

// TestBlockHeaderBtcEncode tests BlockHeader encode and decode.
func TestBlockHeaderBtcEncode(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer not having a separate test func here. Just add the relevant encode/decode bits to TestBlockHeaderWire. Also, the name doesn't match what the function does anyways since it's testing both encode/decode.

For example, after the call to

err := wire.TstWriteBlockHeader(&buf, test.pver, test.in)
...
if !bytes.Equal(buf.Bytes(), test.buf) {
...

Add:

+       err = test.in.BtcEncode(&buf, pver)
+       if err != nil { ... }
+       if !bytes.Equal(buf.Bytes(), test.buf) { ... }

Then the same deal for the decode.

At the current time, there is no difference between the wire encoding
at protocol version 0 and the stable long-term storage format.  These
methods are simply for consistency with the other types.
@davecgh
Copy link
Member

davecgh commented Jul 22, 2015

Looks good now. OK

@conformal-deploy conformal-deploy merged commit eb4ad09 into btcsuite:master Jul 22, 2015
@dajohi dajohi deleted the wire_blockheader branch October 27, 2015 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants