Commit 03270ff2 authored by jiangpeng's avatar jiangpeng

Merge remote-tracking branch 'upstream/master' into add-dapp-vote

parents 004e6d2a 5788d69f
......@@ -3,7 +3,7 @@ module github.com/33cn/plugin
go 1.12
require (
github.com/33cn/chain33 v1.65.1-0.20210115070259-1e4df1700e2e
github.com/33cn/chain33 v1.65.1-0.20210126054237-998e3aae5318
github.com/BurntSushi/toml v0.3.1
github.com/NebulousLabs/Sia v1.3.7
github.com/NebulousLabs/errors v0.0.0-20181203160057-9f787ce8f69e // indirect
......
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/33cn/chain33 v1.65.1-0.20210115070259-1e4df1700e2e h1:VuKDED/KY1G+cErADqu1L5uKW+m/5JfYeapHycAUEJc=
github.com/33cn/chain33 v1.65.1-0.20210115070259-1e4df1700e2e/go.mod h1:XEhB5IOpLl42xM37TpYzFNJg48U4cYIe7dZVmNA/78Y=
github.com/33cn/chain33 v1.65.1-0.20210126054237-998e3aae5318 h1:lLkGn0FxMM1Z3uAMBx2KAgICOLRGrCojmtX8eCht+Fk=
github.com/33cn/chain33 v1.65.1-0.20210126054237-998e3aae5318/go.mod h1:XEhB5IOpLl42xM37TpYzFNJg48U4cYIe7dZVmNA/78Y=
github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9 h1:HD8gA2tkByhMAwYaFAX9w2l7vxvBQ5NMoxDrkhqhtn4=
github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
......
all:
go get -v -u gitlab.33.cn/chain33/chain33
go build -i -o tool github.com/33cn/chain33/cmd/tools
./tool import --path "." --packname "github.com/33cn/plugin" --conf "" --out "plugin.toml"
......@@ -1010,14 +1010,26 @@ func (policy *privacyPolicy) buildAndStoreWalletTxDetail(param *buildStoreWallet
}
func (policy *privacyPolicy) checkExpireFTXOOnTimer() {
operater := policy.getWalletOperate()
header := operater.GetLastHeader()
header := policy.getWalletOperate().GetLastHeader()
if header == nil {
bizlog.Error("checkExpireFTXOOnTimer Can not get last header.")
return
}
policy.store.moveFTXO2UTXOWhenFTXOExpire(header.Height, header.BlockTime)
curFTXOTxs, keys := policy.store.getFTXOlist()
if len(curFTXOTxs) == 0 {
return
}
dbbatch := policy.store.NewBatch(true)
for i, ftxo := range curFTXOTxs {
if !ftxo.IsExpire(header.GetHeight(), header.GetBlockTime()) {
continue
}
policy.store.moveFTXO2UTXO(keys[i], dbbatch)
bizlog.Debug("moveFTXO2UTXOWhenFTXOExpire", "moveFTXO2UTXO key", string(keys[i]), "expire ftxo", ftxo)
}
err := dbbatch.Write()
if err != nil {
bizlog.Error("checkExpireFTXOOnTimer", "db write err", err)
}
}
func (policy *privacyPolicy) checkWalletStoreData() {
......
......@@ -963,16 +963,3 @@ func (store *privacyStore) moveSTXO2FTXO(tx *types.Transaction, txhash string, n
newbatch.Write()
return nil
}
func (store *privacyStore) moveFTXO2UTXOWhenFTXOExpire(blockheight, blocktime int64) {
dbbatch := store.NewBatch(true)
curFTXOTxs, keys := store.getFTXOlist()
for i, ftxo := range curFTXOTxs {
if !ftxo.IsExpire(blockheight, blocktime) {
continue
}
store.moveFTXO2UTXO(keys[i], dbbatch)
bizlog.Debug("moveFTXO2UTXOWhenFTXOExpire", "moveFTXO2UTXO key", string(keys[i]), "ftxo.IsExpire", ftxo.IsExpire(blockheight, blocktime))
}
dbbatch.Write()
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment