aboutsummaryrefslogtreecommitdiffstats
path: root/eth/protocol.go
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2015-03-30 22:21:41 +0800
committerzelig <viktor.tron@gmail.com>2015-04-01 19:32:42 +0800
commit6ffea34d8bf19fb358c1a7f01e20bf25f1061c5e (patch)
tree7a8b1a60915ef36b66a36ccaacc62b2f7db4f878 /eth/protocol.go
parent82da6bf4d213784cfc7ba45432f9f96c2d6b4d9d (diff)
downloadgo-tangerine-6ffea34d8bf19fb358c1a7f01e20bf25f1061c5e.tar
go-tangerine-6ffea34d8bf19fb358c1a7f01e20bf25f1061c5e.tar.gz
go-tangerine-6ffea34d8bf19fb358c1a7f01e20bf25f1061c5e.tar.bz2
go-tangerine-6ffea34d8bf19fb358c1a7f01e20bf25f1061c5e.tar.lz
go-tangerine-6ffea34d8bf19fb358c1a7f01e20bf25f1061c5e.tar.xz
go-tangerine-6ffea34d8bf19fb358c1a7f01e20bf25f1061c5e.tar.zst
go-tangerine-6ffea34d8bf19fb358c1a7f01e20bf25f1061c5e.zip
check TxMsg
- add validation on TxMsg checking for nil - add test for nil transaction - add test for zero value transaction (no extra validation needed)
Diffstat (limited to 'eth/protocol.go')
-rw-r--r--eth/protocol.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/eth/protocol.go b/eth/protocol.go
index f0a749d33..214eed875 100644
--- a/eth/protocol.go
+++ b/eth/protocol.go
@@ -185,7 +185,10 @@ func (self *ethProtocol) handle() error {
if err := msg.Decode(&txs); err != nil {
return self.protoError(ErrDecode, "msg %v: %v", msg, err)
}
- for _, tx := range txs {
+ for i, tx := range txs {
+ if tx == nil {
+ return self.protoError(ErrDecode, "transaction %d is nil", i)
+ }
jsonlogger.LogJson(&logger.EthTxReceived{
TxHash: tx.Hash().Hex(),
RemoteId: self.peer.ID().String(),