Git Product home page Git Product logo

Comments (1)

ViktorTigerstrom avatar ViktorTigerstrom commented on June 5, 2024 1

Thanks for the issue report @kulisekf!

I've reproduced the issue and have verified that "settled_balance" indeed doesn't include the local balance if a non wallet close_address is passed when opening the channel.

The issue is that in chain_watcher.go we assign the value for the SettledBalance to the local localAmt variable:

SettledBalance: localAmt,

The localAmt variable is assigned at:

localAmt := c.toSelfAmount(broadcastTx)

Now the toSelfAmount func will currently only return balance for addresses which are controlled by the wallet due to the definition of the isOurAddr func, and not for non wallet addresses, despite the fact the address has been sent in as our close_address for the channel.

func (c *chainWatcher) toSelfAmount(tx *wire.MsgTx) btcutil.Amount {
var selfAmt btcutil.Amount
for _, txOut := range tx.TxOut {
_, addrs, _, err := txscript.ExtractPkScriptAddrs(
// Doesn't matter what net we actually pass in.
txOut.PkScript, &chaincfg.TestNet3Params,
)
if err != nil {
continue
}
for _, addr := range addrs {
if c.cfg.isOurAddr(addr) {
selfAmt += btcutil.Amount(txOut.Value)
}
}
}
return selfAmt
}

That behaviour would need to be changed in order to solve this issue.

I think a potential solution would be to modify the isOurAddr func that is sent in to chainWatcher, and that the function also matches against the close_address if one has been set. Though I haven't verified if this would work as expected nor if this is the optimal solution.

isOurAddr: c.cfg.IsOurAddress,

The isOurAddr func would also need to be updated if an address is passed as the delivery_addr during the closechannel call.

from lnd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.