Skip to content

Commit

Permalink
ZEUS-2533: Approach 3: coin control fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kaloudis committed Nov 14, 2024
1 parent f4800cd commit 146e440
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion backends/LND.ts
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ export default class LND {
supportsCoinControl = () => this.supports('v0.12.0');
supportsChannelCoinControl = () => this.supports('v0.17.0');
supportsHopPicking = () => this.supports('v0.11.0');
supportsAccounts = () => this.supports('v0.18.3');
supportsAccounts = () => this.supports('v0.13.0');
supportsRouting = () => true;
supportsNodeInfo = () => true;
singleFeesEarnedTotal = () => false;
Expand Down
2 changes: 1 addition & 1 deletion backends/LightningNodeConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ export default class LightningNodeConnect {
supportsChannelCoinControl = () =>
this.permNewAddress && this.supports('v0.17.0');
supportsHopPicking = () => this.permOpenChannel;
supportsAccounts = () => this.permImportAccount && this.supports('v0.18.3');
supportsAccounts = () => this.permImportAccount;
supportsRouting = () => this.permForwardingHistory;
supportsNodeInfo = () => true;
singleFeesEarnedTotal = () => false;
Expand Down
17 changes: 9 additions & 8 deletions stores/TransactionsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@ export default class TransactionsStore {
@action
public finalizePsbtAndBroadcast = (
funded_psbt: string,
backwardsCompat?: boolean
defaultAccount?: boolean
) => {
this.funded_psbt = '';
this.loading = true;

if (backwardsCompat) {
if (defaultAccount) {
return BackendUtils.finalizePsbt({ funded_psbt })
.then((data: any) => {
const raw_final_tx = data.raw_final_tx;
Expand Down Expand Up @@ -306,7 +306,8 @@ export default class TransactionsStore {
};

public sendCoinsLNDCoinControl = (
transactionRequest: TransactionRequest
transactionRequest: TransactionRequest,
defaultAccount?: boolean
) => {
const {
utxos,
Expand Down Expand Up @@ -357,10 +358,7 @@ export default class TransactionsStore {
this.funded_psbt = funded_psbt;
this.loading = false;
} else {
this.finalizePsbtAndBroadcast(
funded_psbt,
!BackendUtils.supportsAccounts()
);
this.finalizePsbtAndBroadcast(funded_psbt, defaultAccount);
}
})
.catch((error: any) => {
Expand Down Expand Up @@ -406,7 +404,10 @@ export default class TransactionsStore {
(transactionRequest?.additional_outputs?.length &&
transactionRequest?.additional_outputs?.length > 0)
) {
return this.sendCoinsLNDCoinControl(transactionRequest);
return this.sendCoinsLNDCoinControl(
transactionRequest,
transactionRequest.account === 'default'
);
}

this.crafting = false;
Expand Down

0 comments on commit 146e440

Please sign in to comment.