mirror of
https://github.com/btcsuite/btcd.git
synced 2026-08-13 12:32:51 +02:00
rpc: test submitblock trailing byte rejection
This commit is contained in:
parent
ac17d23235
commit
676f61b91e
1 changed files with 17 additions and 0 deletions
|
|
@ -147,6 +147,23 @@ func TestHandleGetBlockTemplateProposalRejectsTrailingBytes(t *testing.T) {
|
|||
require.Nil(t, result)
|
||||
}
|
||||
|
||||
// TestHandleSubmitBlockRejectsTrailingBytes ensures submitblock rejects byte
|
||||
// strings that contain a valid block plus trailing data.
|
||||
func TestHandleSubmitBlockRejectsTrailingBytes(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
defer func() {
|
||||
recovered := recover()
|
||||
require.Nil(t, recovered, "handler reached sync manager")
|
||||
}()
|
||||
|
||||
cmd := btcjson.NewSubmitBlockCmd(blockHexWithTrailingByte(t), nil)
|
||||
result, err := handleSubmitBlock(&rpcServer{}, cmd, make(chan struct{}))
|
||||
|
||||
requireRPCErrorCode(t, err, btcjson.ErrRPCDeserialization)
|
||||
require.Nil(t, result)
|
||||
}
|
||||
|
||||
var (
|
||||
// TODO(yy): make a `btctest` package and move these testing txns there
|
||||
// so they be used in other tests.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue