From c74c07eed19f8a328f47aca7b9e01dcdf8731847 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 3 Mar 2015 16:20:38 +0100 Subject: Fixed error for invalid transaction --- core/error.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'core/error.go') diff --git a/core/error.go b/core/error.go index e86bacb2d..fb1eaed84 100644 --- a/core/error.go +++ b/core/error.go @@ -87,6 +87,24 @@ func IsNonceErr(err error) bool { return ok } +type InvalidTxErr struct { + Message string +} + +func (err *InvalidTxErr) Error() string { + return err.Message +} + +func InvalidTxError(err error) *InvalidTxErr { + return &InvalidTxErr{fmt.Sprintf("%v", err)} +} + +func IsInvalidTxErr(err error) bool { + _, ok := err.(*InvalidTxErr) + + return ok +} + type OutOfGasErr struct { Message string } -- cgit v1.2.3 From 871dfd399be8ee657109112d527645c2c1b3a8f9 Mon Sep 17 00:00:00 2001 From: Gustav Simonsson Date: Tue, 3 Mar 2015 18:41:51 +0100 Subject: Add initial implementation of block tests * Add blocktest cmd and support for block tests files in tests/BlockTests , the launched node does not connect to network, resets state with a genesis block from the test file and starts the RPC API --- core/error.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/error.go') diff --git a/core/error.go b/core/error.go index fb1eaed84..514cd076b 100644 --- a/core/error.go +++ b/core/error.go @@ -22,7 +22,7 @@ func (err *ParentErr) Error() string { } func ParentError(hash []byte) error { - return &ParentErr{Message: fmt.Sprintf("Block's parent unkown %x", hash)} + return &ParentErr{Message: fmt.Sprintf("Block's parent unknown %x", hash)} } func IsParentErr(err error) bool { -- cgit v1.2.3 From 88ff13c241faff1d58e47f12bd283c112de7225a Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 5 Mar 2015 19:51:25 +0100 Subject: Spec changes. * All errors during state transition result in an invalid tx --- core/error.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'core/error.go') diff --git a/core/error.go b/core/error.go index 514cd076b..04e40646c 100644 --- a/core/error.go +++ b/core/error.go @@ -146,3 +146,19 @@ func IsKnownBlockErr(e error) bool { _, ok := e.(*KnownBlockError) return ok } + +type ValueTransferError struct { + message string +} + +func ValueTransferErr(str string, v ...interface{}) *ValueTransferError { + return &ValueTransferError{fmt.Sprintf(str, v...)} +} + +func (self *ValueTransferError) Error() string { + return self.message +} +func IsValueTransferErr(e error) bool { + _, ok := e.(*ValueTransferError) + return ok +} -- cgit v1.2.3