OSDN Git Service
(root)
/
bytom
/
vapor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add initBatch commitBatch
[bytom/vapor.git]
/
database
/
wallet_store.go
diff --git
a/database/wallet_store.go
b/database/wallet_store.go
index
dd41f3c
..
9d3bc41
100644
(file)
--- a/
database/wallet_store.go
+++ b/
database/wallet_store.go
@@
-60,7
+60,8
@@
type WalletStorer interface {
// WalletStore store wallet using leveldb
type WalletStore struct {
// WalletStore store wallet using leveldb
type WalletStore struct {
- DB dbm.DB
+ DB dbm.DB
+ batch dbm.Batch
}
// NewWalletStore create new WalletStore struct
}
// NewWalletStore create new WalletStore struct
@@
-70,6
+71,18
@@
func NewWalletStore(db dbm.DB) *WalletStore {
}
}
}
}
+func (store *WalletStore) initBatch() {
+ if store.batch == nil {
+ store.batch = store.DB.NewBatch()
+ }
+}
+
+func (store *WalletStore) commitBatch() {
+ if store.batch != nil {
+ store.batch.Write()
+ }
+}
+
// ContractKey account control promgram store prefix
func ContractKey(hash common.Hash) []byte {
return append([]byte(contractPrefix), hash[:]...)
// ContractKey account control promgram store prefix
func ContractKey(hash common.Hash) []byte {
return append([]byte(contractPrefix), hash[:]...)