Skip to content

Commit

Permalink
add txtype
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiquan911 committed Jul 16, 2019
1 parent 8ded6cc commit 5e79489
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 9 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ go 1.12
require (
github.com/asdine/storm v2.1.2+incompatible
github.com/astaxie/beego v1.11.1
github.com/blocktree/go-owcdrivers v1.0.4
github.com/blocktree/go-owcdrivers v1.0.12
github.com/blocktree/go-owcrypt v1.0.1
github.com/blocktree/openwallet v1.4.1
github.com/blocktree/openwallet v1.4.6
github.com/bndr/gotabulate v1.1.2
github.com/btcsuite/btcutil v0.0.0-20190316010144-3ac1210f4b38
github.com/golang/protobuf v1.3.1
Expand Down
13 changes: 13 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,33 @@ docker.io/go-docker v1.0.0/go.mod h1:7tiAn5a0LFmjbPDbyTPOaTTOuG1ZRNXdPA6RvKY+fpY
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/DataDog/zstd v1.3.5 h1:DtpNbljikUepEPD16hD4LvIcmhnhdLTiW/5pHgbmp14=
github.com/DataDog/zstd v1.3.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
github.com/DataDog/zstd v1.4.0/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/Microsoft/go-winio v0.4.12/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA=
github.com/NebulousLabs/entropy-mnemonics v0.0.0-20181203154559-bc7e13c5ccd8/go.mod h1:ed2ZsnmJfqVNZOwxWWFZaSHJY3ifOjCS7i5yX9dvKHs=
github.com/Sereal/Sereal v0.0.0-20190408200019-e0834539921c h1:KpfBJS0V5FI8eyVynflQAscUTC43F8OhIZjwTmRc07I=
github.com/Sereal/Sereal v0.0.0-20190408200019-e0834539921c/go.mod h1:D0JMgToj/WdxCgd30Kc1UcA9E+WdZoJqeVOuYW7iTBM=
github.com/Sereal/Sereal v0.0.0-20190529075751-4d99287c2c28/go.mod h1:D0JMgToj/WdxCgd30Kc1UcA9E+WdZoJqeVOuYW7iTBM=
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
github.com/allegro/bigcache v1.2.0/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
github.com/asdine/storm v2.1.2+incompatible h1:dczuIkyqwY2LrtXPz8ixMrU/OFgZp71kbKTHGrXYt/Q=
github.com/asdine/storm v2.1.2+incompatible/go.mod h1:RarYDc9hq1UPLImuiXK3BIWPJLdIygvV3PsInK0FbVQ=
github.com/astaxie/beego v1.11.1 h1:6DESefxW5oMcRLFRKi53/6exzup/IR6N4EzzS1n6CnQ=
github.com/astaxie/beego v1.11.1/go.mod h1:i69hVzgauOPSw5qeyF4GVZhn7Od0yG5bbCGzmhbWxgQ=
github.com/beego/goyaml2 v0.0.0-20130207012346-5545475820dd/go.mod h1:1b+Y/CofkYwXMUU0OhQqGvsY2Bvgr4j6jfT699wyZKQ=
github.com/beego/x2j v0.0.0-20131220205130-a0352aadc542/go.mod h1:kSeGC/p1AbBiEp5kat81+DSQrZenVBZXklMLaELspWU=
github.com/belogik/goes v0.0.0-20151229125003-e54d722c3aff/go.mod h1:PhH1ZhyCzHKt4uAasyx+ljRCgoezetRNf59CUtwUkqY=
github.com/blocktree/ddmchain-adapter v1.0.5 h1:Lx8zD0lOHb9TJ7EcGJQhyvpDkYko6OoV8uwudKRKlJA=
github.com/blocktree/ddmchain-adapter v1.0.5/go.mod h1:oqsMVtGaRVm0JIEld4Ge9vblhwjSuv4k73artQE+EO8=
github.com/blocktree/go-owcdrivers v1.0.0 h1:dMxbi+In7On3fq/2cfaO+IdKY35l++4cPFe6jcdJanM=
github.com/blocktree/go-owcdrivers v1.0.0/go.mod h1:AzbIxzzRcSszV/XwOiu83QqKuGTuWyCdCrVfGNt2bk8=
github.com/blocktree/go-owcdrivers v1.0.2 h1:rFUL4wexwn1nT++SCCXPFOjV2WfBJGHyclS8UW/sElk=
github.com/blocktree/go-owcdrivers v1.0.2/go.mod h1:AzbIxzzRcSszV/XwOiu83QqKuGTuWyCdCrVfGNt2bk8=
github.com/blocktree/go-owcdrivers v1.0.4 h1:ojdUJiOD40fxuW1UrLU79RNTObtdFCMx0miwdW3T72o=
github.com/blocktree/go-owcdrivers v1.0.4/go.mod h1:HS5S8MYW1hdN6hEmwgqu/kWyFPkxvjGN9Le0zAGmFZM=
github.com/blocktree/go-owcdrivers v1.0.5/go.mod h1:HS5S8MYW1hdN6hEmwgqu/kWyFPkxvjGN9Le0zAGmFZM=
github.com/blocktree/go-owcdrivers v1.0.12 h1:of6EMtvzg46KEbQsi10d7QT8jkrkicQIob1wsXvyIRg=
github.com/blocktree/go-owcdrivers v1.0.12/go.mod h1:TKevypdvkQD4ItBGscwMJqWWMOhDo9vXwnV1wacNs9w=
github.com/blocktree/go-owcrypt v1.0.0 h1:u3B59ZjmZ6vB8NrIicUvKKiiDY2oeJCInWsEq1swwSY=
github.com/blocktree/go-owcrypt v1.0.0/go.mod h1:5FCinL/4XVEqbmAFTOUgfMJVNJEw6WzVy624qsxzZC8=
github.com/blocktree/go-owcrypt v1.0.1 h1:hTqRN7mH2L0mVzHcL9jE0YM7B4oUFiDvksLEpam7oU8=
Expand All @@ -30,6 +38,8 @@ github.com/blocktree/openwallet v1.2.1 h1:t+AsfEZvBGxkhUYZWcOsuAoeFdNxSMJ9I1VOPq
github.com/blocktree/openwallet v1.2.1/go.mod h1:7IxhXsLl0WOg4cz8EP/HCU6LBkal2jN1vdH4dNzHOzw=
github.com/blocktree/openwallet v1.4.1 h1:Erju/SLK3qjU9OZ4JEsrUBD6wfvC0PBC+28rhy+BLM4=
github.com/blocktree/openwallet v1.4.1/go.mod h1:jStJigV8cNTOmvzvWJ4bdjXhiRvtQtSh++uJxSZRcb0=
github.com/blocktree/openwallet v1.4.6 h1:u5rjB/XcMmbFomVaKunVcas1ATNz0wYf7P5HkQD4prM=
github.com/blocktree/openwallet v1.4.6/go.mod h1:e5IqJ6OqCM5qEN4TTxeeWbd3l3kCRLPC6fG4/KLiA7I=
github.com/bndr/gotabulate v1.1.2 h1:yC9izuZEphojb9r+KYL4W9IJKO/ceIO8HDwxMA24U4c=
github.com/bndr/gotabulate v1.1.2/go.mod h1:0+8yUgaPTtLRTjf49E8oju7ojpU11YmXyvq1LbPAb3U=
github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60=
Expand Down Expand Up @@ -63,6 +73,7 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
github.com/ethereum/go-ethereum v1.8.24/go.mod h1:PwpWDrCLZrV+tfrhqqF6kPknbISMHaJv9Ln3kPCZLwY=
Expand All @@ -71,6 +82,7 @@ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeME
github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
github.com/go-redis/redis v6.15.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
Expand Down Expand Up @@ -177,6 +189,7 @@ google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9Ywl
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0 h1:KxkO13IPW4Lslp2bz+KHP2E3gtFlrIGNThxkZQ3g+4c=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.6.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107 h1:xtNn7qFlagY2mQNFHMSRPjT2RkOV4OXM7P5TVy9xATo=
google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
Expand Down
4 changes: 2 additions & 2 deletions openwtester/subscribe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func TestSubscribeAddress(t *testing.T) {
endRunning = make(chan bool, 1)
symbol = "TRX"
addrs = map[string]string{
"TEzdWXvMNE7sBxuQ2N98EX4kEJajQgz5rM": "sender",
"TFHtQPM6SJ2GTebArYkhvZKk4rc3WAmdgE": "sender",
"TRJJ9Mq4aMjdmKWpTDJAgbYNoY2P9Facg5": "receiver",
}
)
Expand Down Expand Up @@ -90,7 +90,7 @@ func TestSubscribeAddress(t *testing.T) {

//log.Debug("already got scanner:", assetsMgr)
scanner := assetsMgr.GetBlockScanner()
scanner.SetRescanBlockHeight(10438073)
scanner.SetRescanBlockHeight(10819505)

if scanner == nil {
log.Error(symbol, "is not support block scan")
Expand Down
4 changes: 3 additions & 1 deletion tron/blockscanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ func (bs *TronBlockScanner) InitTronExtractResult(tx *Contract, result *ExtractR
}
}


amount := decimal.Zero
coin := openwallet.Coin{
Symbol: bs.wm.Symbol(),
Expand Down Expand Up @@ -467,6 +466,7 @@ func (bs *TronBlockScanner) InitTronExtractResult(tx *Contract, result *ExtractR
To: []string{tx.To + ":" + amount.String()},
Status: status,
Reason: reason,
TxType: 0,
}

wxID := openwallet.GenTransactionWxID(transx)
Expand Down Expand Up @@ -520,6 +520,7 @@ func (bs *TronBlockScanner) extractTxInput(tx *Contract, txExtractData *openwall
txInput.Recharge.BlockHeight = tx.BlockHeight
txInput.Recharge.Index = 0 //账户模型填0
txInput.Recharge.CreateAt = time.Now().Unix()
txInput.Recharge.TxType = 0
txExtractData.TxInputs = append(txExtractData.TxInputs, txInput)
}

Expand Down Expand Up @@ -558,6 +559,7 @@ func (bs *TronBlockScanner) extractTxOutput(tx *Contract, txExtractData *openwal
txOutput.Recharge.BlockHeight = tx.BlockHeight
txOutput.Recharge.Index = 0 //账户模型填0
txOutput.Recharge.CreateAt = time.Now().Unix()
txOutput.Recharge.TxType = 0
txExtractData.TxOutputs = append(txExtractData.TxOutputs, txOutput)
}

Expand Down
9 changes: 5 additions & 4 deletions tron/tx_decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (decoder *TransactionDecoder) CreateSimpleTransaction(wrapper openwallet.Wa
}

if len(addresses) == 0 {
return openwallet.Errorf(openwallet.ErrAccountNotAddress,"[%s] have not addresses", accountID)
return openwallet.Errorf(openwallet.ErrAccountNotAddress, "[%s] have not addresses", accountID)
}

searchAddrs := make([]string, 0)
Expand Down Expand Up @@ -336,7 +336,7 @@ func (decoder *TransactionDecoder) CreateTokenTransaction(wrapper openwallet.Wal

if findAddrBalance == nil {
if tokenBalanceNotEnough {
return openwallet.Errorf(openwallet.ErrInsufficientTokenBalanceOfAddress,"the balance: %s is not enough", amountStr)
return openwallet.Errorf(openwallet.ErrInsufficientTokenBalanceOfAddress, "the balance: %s is not enough", amountStr)
}
if balanceNotEnough {
return openwallet.Errorf(openwallet.ErrInsufficientFees, errStr)
Expand Down Expand Up @@ -499,6 +499,7 @@ func (decoder *TransactionDecoder) SubmitRawTransaction(wrapper openwallet.Walle
AccountID: rawTx.Account.AccountID,
Fees: rawTx.Fees,
SubmitTime: time.Now().Unix(),
TxType: 0,
}
tx.WxID = openwallet.GenTransactionWxID(&tx)
return &tx, nil
Expand Down Expand Up @@ -657,8 +658,8 @@ func (decoder *TransactionDecoder) CreateSimpleSummaryRawTransaction(wrapper ope
func (decoder *TransactionDecoder) CreateTokenSummaryRawTransaction(wrapper openwallet.WalletDAI, sumRawTx *openwallet.SummaryRawTransaction) ([]*openwallet.RawTransactionWithError, error) {

var (
rawTxArray = make([]*openwallet.RawTransactionWithError, 0)
accountID = sumRawTx.Account.AccountID
rawTxArray = make([]*openwallet.RawTransactionWithError, 0)
accountID = sumRawTx.Account.AccountID
feesSupportAccount *openwallet.AssetsAccount
)

Expand Down

0 comments on commit 5e79489

Please sign in to comment.