Skip to content

Commit

Permalink
Merge pull request #69 from Elenpay/develop
Browse files Browse the repository at this point in the history
Hotfix returning derivation data in the PSBT as object
  • Loading branch information
Jossec101 authored Jan 13, 2023
2 parents 17e94d6 + 1d77e88 commit 49260c5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/Helpers/LightningHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static void RemoveDuplicateUTXOs(this UTXOChanges utxoChanges)
/// <param name="selectedUtxOs"></param>
/// <param name="multisigCoins"></param>
/// <exception cref="ArgumentException"></exception>
public static void AddDerivationData(ILogger logger, IEnumerable<Key> keys , (PSBT?, bool) result, List<UTXO> selectedUtxOs,
public static (PSBT?, bool) AddDerivationData(ILogger logger, IEnumerable<Key> keys , (PSBT?, bool) result, List<UTXO> selectedUtxOs,
List<ScriptCoin> multisigCoins)
{
if (logger == null) throw new ArgumentNullException(nameof(logger));
Expand All @@ -41,8 +41,9 @@ public static void AddDerivationData(ILogger logger, IEnumerable<Key> keys , (PS
var nbXplorerNetwork = CurrentNetworkHelper.GetCurrentNetwork();
foreach (var key in keys)
{
if (string.IsNullOrWhiteSpace(key.MasterFingerprint) || string.IsNullOrWhiteSpace(key.XPUB)) continue;

var bitcoinExtPubKey = new BitcoinExtPubKey(key.XPUB, nbXplorerNetwork);

var masterFingerprint = HDFingerprint.Parse(key.MasterFingerprint);
var rootedKeyPath = new RootedKeyPath(masterFingerprint, new KeyPath(key.Path));

Expand Down Expand Up @@ -74,6 +75,8 @@ public static void AddDerivationData(ILogger logger, IEnumerable<Key> keys , (PS
}
}
}

return result;
}


Expand Down
2 changes: 1 addition & 1 deletion src/Services/BitcoinService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public BitcoinService(ILogger<BitcoinService> logger,
result.Item1 = builder.BuildPSBT(false);

//Additional fields to support PSBT signing with a HW or the Remote Signer
LightningHelper.AddDerivationData(_logger,walletWithdrawalRequest.Wallet.Keys, result, selectedUTXOs, scriptCoins);
result = LightningHelper.AddDerivationData(_logger,walletWithdrawalRequest.Wallet.Keys, result, selectedUTXOs, scriptCoins);
}
catch (Exception e)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Services/LightningService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ private void CancelPendingChannel(Node source, Lightning.LightningClient client,
}

//Additional fields to support PSBT signing with a HW or the Remote Signer
LightningHelper.AddDerivationData(_logger,channelOperationRequest.Wallet.Keys, result, selectedUtxOs, multisigCoins);
result = LightningHelper.AddDerivationData(_logger,channelOperationRequest.Wallet.Keys, result, selectedUtxOs, multisigCoins);
}
catch (Exception e)
{
Expand Down

0 comments on commit 49260c5

Please sign in to comment.