diff --git a/script/mongodb.js b/script/mongodb.js index 1ebd111..4c58069 100644 --- a/script/mongodb.js +++ b/script/mongodb.js @@ -19,6 +19,7 @@ db.sync_iris_asset_detail.createIndex({"to": -1, "height": -1}); db.sync_iris_asset_detail.createIndex({"to": -1, "subject": -1}); db.sync_iris_tx.createIndex({"tx_hash": -1}, {"unique": true, "background": true}); +db.sync_iris_tx.createIndex({"ibc_packet_hash": -1}, {"background": true}); db.sync_iris_tx.createIndex({"to": -1, "height": -1}, {"background": true}); db.sync_iris_tx.createIndex({'from': 1}, {'background': true}); db.sync_iris_tx.createIndex({'initiator': 1}, {'background': true}); @@ -30,6 +31,7 @@ db.sync_cosmos_task.createIndex({"start_height": 1, "end_height": 1}, {"unique": db.sync_cosmos_block.createIndex({"height": -1}, {"unique": true, "background": true}); db.sync_cosmos_tx.createIndex({"tx_hash": -1}, {"unique": true, "background": true}); +db.sync_cosmos_tx.createIndex({"ibc_packet_hash": -1}, {"background": true}); db.sync_cosmos_tx.createIndex({"to": -1, "height": -1}, {"background": true}); db.sync_cosmos_tx.createIndex({"status": 1}, {"background": true}); db.sync_cosmos_tx.createIndex({"type": 1}, {"background": true}); diff --git a/service/cosmos/block/parse_tx.go b/service/cosmos/block/parse_tx.go index 4ac1bf8..f7517e2 100644 --- a/service/cosmos/block/parse_tx.go +++ b/service/cosmos/block/parse_tx.go @@ -333,6 +333,10 @@ func buildIBCPacketHashByEvents(events []cmodel.Event) string { } } + if packetStr == "" { + return "" + } + return cutils.Md5Encrypt([]byte(packetStr)) } diff --git a/service/cosmos/model/msg/bank.go b/service/cosmos/model/msg/bank.go index ef1769e..eb9ab47 100644 --- a/service/cosmos/model/msg/bank.go +++ b/service/cosmos/model/msg/bank.go @@ -7,9 +7,9 @@ import ( type ( DocTxMsgTransfer struct { - FromAddress string `json:"from_address"` - ToAddress string `json:"to_address" ` - Amount []CoinStr `json:"amount"` + FromAddress string `bson:"from_address"` + ToAddress string `bson:"to_address" ` + Amount []CoinStr `bson:"amount"` } ) diff --git a/service/iris/block/parse_tx.go b/service/iris/block/parse_tx.go index d96cc59..e02b307 100644 --- a/service/iris/block/parse_tx.go +++ b/service/iris/block/parse_tx.go @@ -291,6 +291,10 @@ func buildIBCPacketHashByEvents(events []imodel.Event) string { } } + if packetStr == "" { + return "" + } + return utils.Md5Encrypt([]byte(packetStr)) } diff --git a/service/iris/block/parse_tx_test.go b/service/iris/block/parse_tx_test.go index f99a58a..e4dea6a 100644 --- a/service/iris/block/parse_tx_test.go +++ b/service/iris/block/parse_tx_test.go @@ -24,7 +24,7 @@ func TestIris_Block_ParseIrisTx(t *testing.T) { { name: "test parse iris tx", args: args{ - b: 17438, + b: 17359, client: client, }, }, diff --git a/service/iris/go.sum b/service/iris/go.sum index d08c8a7..e5df6c4 100644 --- a/service/iris/go.sum +++ b/service/iris/go.sum @@ -137,8 +137,10 @@ github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6 github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= @@ -337,6 +339,7 @@ google.golang.org/grpc v1.23.1 h1:q4XQuHFC6I28BKZpo6IYyb3mNO+l7lSOxRuYTCiDfXk= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw= @@ -345,6 +348,7 @@ gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXL gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637 h1:yiW+nvdHb9LVqSHQBXfZCieqV4fzYhNBql77zY0ykqs= gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637/go.mod h1:BHsqpu/nsuzkT5BpiH1EMZPLyqSMM8JbIavyFACoFNk= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=