Skip to content

Commit

Permalink
fix(compat): correct selector
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanswrt committed Jul 13, 2021
1 parent ab974f2 commit e7ff903
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compat/v0/compat.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ func NetParams(chain multichain.Chain, net multichain.Network) *chaincfg.Params
}

func V1TxFromV0Mint(ctx context.Context, v0tx Tx, bindings *binding.Binding) (tx.Tx, error) {
selector := tx.Selector(fmt.Sprintf("%s/fromEthereum", v0tx.To[0:3]))
selector := tx.Selector(fmt.Sprintf("%s/toEthereum", v0tx.To[0:3]))
utxo := v0tx.In.Get("utxo").Value.(ExtBtcCompatUTXO)
vout := utxo.VOut.Int.Uint64()
txidB, err := chainhash.NewHashFromStr(hex.EncodeToString(utxo.TxHash[:]))
Expand Down
4 changes: 3 additions & 1 deletion compat/v0/compat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"github.com/renproject/darknode/binding"
"github.com/renproject/darknode/tx"
"github.com/renproject/id"
"github.com/renproject/lightnode/compat/v0"
v0 "github.com/renproject/lightnode/compat/v0"
"github.com/renproject/lightnode/db"
"github.com/renproject/lightnode/resolver"
"github.com/renproject/lightnode/testutils"
Expand Down Expand Up @@ -162,6 +162,8 @@ var _ = Describe("Compat V0", func() {
Expect(err).ShouldNot(HaveOccurred())
Expect(len(keys)).Should(Equal(1))

Expect(v1.Tx.Selector).Should(Equal(tx.Selector("BTC/toEthereum")))

// Check that redis mapped the hashes correctly
hash := v1.Tx.Hash.String()
storedHash, err := client.Get(keys[0]).Result()
Expand Down

0 comments on commit e7ff903

Please sign in to comment.