Browse Source

Make Counter app return nil hash initially

pull/1780/head
Jae Kwon 9 years ago
parent
commit
21abda0602
1 changed files with 7 additions and 3 deletions
  1. +7
    -3
      example/counter.go

+ 7
- 3
example/counter.go 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 {


Loading…
Cancel
Save