revault/revaultd

Maybe we could give Spend outputs larger than Bitcoin dust but lower than Revault dust to managers

Opened this issue · 6 comments

Currently we would give away up to 199_999 sats in fees to the miners. Miners getting paid is good, but hey it's 100$ at current BTC/USD price!

// Add a change output if it would not be dust according to our standard (200k sats
// atm, see DUST_LIMIT).
// 8 (amount) + 1 (len) + 1 (v0) + 1 (push) + 32 (witscript hash)
const P2WSH_TXO_WEIGHT: u64 = 43 * 4;
let with_change_weight = nochange_tx
.max_weight()
.checked_add(P2WSH_TXO_WEIGHT)
.expect("weight computation bug");
let cur_fees = nochange_tx.fees();
let want_fees = with_change_weight
// Mental gymnastic: sat/vbyte to sat/wu rounded up
.checked_mul(feerate_vb + 3)
.map(|vbyte| vbyte.checked_div(4).unwrap());
let change_value = want_fees.map(|f| cur_fees.checked_sub(f));
log::debug!(
"Weight with change: '{}' -- Fees without change: '{}' -- Wanted feerate: '{}' \
-- Wanted fees: '{:?}' -- Change value: '{:?}'",
with_change_weight,
cur_fees,
feerate_vb,
want_fees,
change_value
);

Also we are not interested in outputs just above network dust, so maybe if it's higher than the CPFP output value?

What do you mean "to managers"? To a multisig between all the managers? IMHO this makes the UX way more complicated.
I would use just the network dust here and create the change if the value is above dust. In future we could be smarter and start saying "we create the change only if it's worth it" (I mean, if the fees for spending it aren't more expensive than the utxo itself)...

We should not create a change paying to the N-of-N of the stakeholders in this case.

Ah right, agreed

However, if above the network dust it could be sent to the M-of-M of the managers and used to feebump the Unvaults and Spends

Ok I get your point, but this could be confusing. Is it too much of a problem to send it to the cpfp wallet instead (1-of-M)?

Concept ACK then :)

The "deposit split project" would help here as we would batch small inputs to create a vault of a given threshold.