|
|
|
|
@ -433,9 +433,16 @@ def estimate_tx_size(ins, outs, txtype='p2pkh'):
|
|
|
|
|
out: 8+1+3+2+20=34, in: 1+32+4+1+1+~73+1+1+33=147, |
|
|
|
|
ver:4,seq:4, +2 (len in,out) |
|
|
|
|
total ~= 34*len_out + 147*len_in + 10 (sig sizes vary slightly) |
|
|
|
|
Assuming p2sh M of N multisig: |
|
|
|
|
"ins" must contain M, N so ins= (numins, M, N) (crude assuming all same) |
|
|
|
|
74*M + 34*N + 45 per input, so total ins ~ len_ins * (45+74M+34N) |
|
|
|
|
so total ~ 34*len_out + (45+74M+34N)*len_in + 10 |
|
|
|
|
''' |
|
|
|
|
if txtype == 'p2pkh': |
|
|
|
|
return 10 + ins * 147 + 34 * outs |
|
|
|
|
elif txtype == 'p2shMofN': |
|
|
|
|
ins, M, N = ins |
|
|
|
|
return 10 + (45 + 74*M + 34*N) * ins + 34 * outs |
|
|
|
|
else: |
|
|
|
|
raise NotImplementedError("Non p2pkh transaction size estimation not" + |
|
|
|
|
"yet implemented") |
|
|
|
|
raise NotImplementedError("Transaction size estimation not" + |
|
|
|
|
"yet implemented for type: " + txtype) |
|
|
|
|
|