Make Counter app return nil hash initially

This commit is contained in:
Jae Kwon 2015-12-04 00:59:26 -08:00
parent 7b1ebb9245
commit 21abda0602
1 changed files with 7 additions and 3 deletions

View File

@ -68,10 +68,14 @@ func (appC *CounterAppContext) AppendTx(tx []byte) ([]types.Event, types.RetCode
}
func (appC *CounterAppContext) GetHash() ([]byte, types.RetCode) {
hash := make([]byte, 32)
binary.PutVarint(hash, int64(appC.txCount))
appC.hashCount += 1
return hash, 0
if appC.txCount == 0 {
return nil, 0
} else {
hash := make([]byte, 32)
binary.PutVarint(hash, int64(appC.txCount))
return hash, 0
}
}
func (appC *CounterAppContext) Commit() types.RetCode {