Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Commit

Permalink
optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
kaifei committed Oct 23, 2019
1 parent b602b43 commit ea72cd4
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 4 deletions.
2 changes: 2 additions & 0 deletions script/mongodb.js
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand All @@ -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});
Expand Down
4 changes: 4 additions & 0 deletions service/cosmos/block/parse_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,10 @@ func buildIBCPacketHashByEvents(events []cmodel.Event) string {
}
}

if packetStr == "" {
return ""
}

return cutils.Md5Encrypt([]byte(packetStr))
}

Expand Down
6 changes: 3 additions & 3 deletions service/cosmos/model/msg/bank.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
)

Expand Down
4 changes: 4 additions & 0 deletions service/iris/block/parse_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,10 @@ func buildIBCPacketHashByEvents(events []imodel.Event) string {
}
}

if packetStr == "" {
return ""
}

return utils.Md5Encrypt([]byte(packetStr))
}

Expand Down
2 changes: 1 addition & 1 deletion service/iris/block/parse_tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestIris_Block_ParseIrisTx(t *testing.T) {
{
name: "test parse iris tx",
args: args{
b: 17438,
b: 17359,
client: client,
},
},
Expand Down
4 changes: 4 additions & 0 deletions service/iris/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand All @@ -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=
Expand Down

0 comments on commit ea72cd4

Please sign in to comment.