Skip to content

Commit

Permalink
fix(BUX-644): handle new paymail pub key
Browse files Browse the repository at this point in the history
  • Loading branch information
arkadiuszos4chain committed Mar 14, 2024
1 parent 7f45633 commit 2ed7903
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions transports/authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ func SignInputs(dt *models.DraftTransaction, xPriv *bip32.ExtendedKey) (signedHe

// Sign the inputs
for index, input := range dt.Configuration.Inputs {
dst := input.Destination

// Get the locking script
var ls *bscript.Script
if ls, err = bscript.NewFromHexString(
input.Destination.LockingScript,
dst.LockingScript,
); err != nil {
resError = WrapError(err)
return
Expand All @@ -59,7 +60,7 @@ func SignInputs(dt *models.DraftTransaction, xPriv *bip32.ExtendedKey) (signedHe
// Derive the child key (chain)
var chainKey *bip32.ExtendedKey
if chainKey, err = xPriv.Child(
input.Destination.Chain,
dst.Chain,
); err != nil {
resError = WrapError(err)
return
Expand All @@ -68,12 +69,22 @@ func SignInputs(dt *models.DraftTransaction, xPriv *bip32.ExtendedKey) (signedHe
// Derive the child key (num)
var numKey *bip32.ExtendedKey
if numKey, err = chainKey.Child(
input.Destination.Num,
dst.Num,
); err != nil {
resError = WrapError(err)
return
}

// Derive key for paymail destination
if dst.PaymailExternalDerivationNum != nil {

Check failure on line 79 in transports/authentication.go

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

dst.PaymailExternalDerivationNum undefined (type models.Destination has no field or method PaymailExternalDerivationNum)

Check failure on line 79 in transports/authentication.go

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

dst.PaymailExternalDerivationNum undefined (type models.Destination has no field or method PaymailExternalDerivationNum)
if numKey, err = chainKey.Child(
*dst.PaymailExternalDerivationNum,

Check failure on line 81 in transports/authentication.go

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

dst.PaymailExternalDerivationNum undefined (type models.Destination has no field or method PaymailExternalDerivationNum)

Check failure on line 81 in transports/authentication.go

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

dst.PaymailExternalDerivationNum undefined (type models.Destination has no field or method PaymailExternalDerivationNum)
); err != nil {
resError = WrapError(err)
return
}
}

// Get the private key
var privateKey *bec.PrivateKey
if privateKey, err = bitcoin.GetPrivateKeyFromHDKey(
Expand Down

0 comments on commit 2ed7903

Please sign in to comment.