RGB-WG / rgb-std

RGB standard libs for WASM & low-level integrations (no FS/networking)

Home Page:https://rgb.tech

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

consume_consignment(force=true) fails if tx height cannot be resolved

nicbus opened this issue · comments

In rgb-std, Stock's consume_consignment takes a force parameter. When it is set to true, errors such as Validity::UnresolvedTransactions and Validity::UnminedTerminals are downgraded to warnings.

When accepting an unmined transaction (e.g. accepting the commitment for a LN funding tx before it's publihed, to prepare commitment txs), a DataError::HeightResolver error is returned because Consignment's update_history receives an error trying to resolve the height of the tx.

I guess this didn't happen before because rgb-contracts's resolve_height used to just return 0.

In my opinion, this prevents consume_consignment from completing in cases where it's supposed to (and force is true).

@dr-orlovsky do you think resolve_height needs to return an error if it can't find the transaction or can its behavior be relaxed so in that case it just returns 0?

It seems it can be relaxed to 0

I am working on the PRs, this is not trivial: we can't use 0 at all since this will result in all recent state (from LN channels or unmined transactions) to come not last but the first in the state history. I will have to change the way we work with that at consensus level.