MCPcopy Create free account
hub / github.com/ElementsProject/lightning / deep_enough

Function deep_enough

wallet/wallet.c:787–818  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

785}
786
787static bool deep_enough(u32 maxheight, const struct utxo *utxo,
788 u32 current_blockheight)
789{
790 if (utxo->close_info
791 && utxo->close_info->option_anchors) {
792 /* BOLT #3:
793 * If `option_anchors` applies to the commitment transaction, the
794 * `to_remote` output is encumbered by a one block csv lock.
795 */
796 if (!utxo->blockheight)
797 return false;
798
799 u32 csv_free = *utxo->blockheight + utxo->close_info->csv - 1;
800 assert(csv_free >= *utxo->blockheight);
801
802 if (csv_free > current_blockheight)
803 return false;
804 }
805
806 bool immature = utxo_is_immature(utxo, current_blockheight);
807 if (immature)
808 return false;
809
810 /* If we require confirmations check that we have a
811 * confirmation height and that it is below the required
812 * maxheight (current_height - minconf) */
813 if (maxheight == 0)
814 return true;
815 if (!utxo->blockheight)
816 return false;
817 return *utxo->blockheight <= maxheight;
818}
819
820/* FIXME: Make this wallet_find_utxos, and branch and bound and I've
821 * left that to @niftynei to do, who actually read the paper! */

Callers 2

wallet_find_utxoFunction · 0.85
wallet_has_fundsFunction · 0.85

Calls 1

utxo_is_immatureFunction · 0.85

Tested by

no test coverage detected