1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
crate::ix!();
/**
| \class CompareTxMemPoolEntryByDescendantScore
|
| Sort an entry by max(score/size of entry's
| tx, score/size with all descendants).
|
*/
pub struct CompareTxMemPoolEntryByDescendantScore {
}
impl CompareTxMemPoolEntryByDescendantScore {
pub fn invoke(&self,
a: &TxMemPoolEntry,
b: &TxMemPoolEntry) -> bool {
todo!();
/*
double a_mod_fee, a_size, b_mod_fee, b_size;
GetModFeeAndSize(a, a_mod_fee, a_size);
GetModFeeAndSize(b, b_mod_fee, b_size);
// Avoid division by rewriting (a/b > c/d) as (a*d > c*b).
double f1 = a_mod_fee * b_size;
double f2 = a_size * b_mod_fee;
if (f1 == f2) {
return a.GetTime() >= b.GetTime();
}
return f1 < f2;
*/
}
/**
| Return the fee/size we're using for
| sorting this entry.
|
*/
pub fn get_mod_fee_and_size(&self,
a: &TxMemPoolEntry,
mod_fee: &mut f64,
size: &mut f64) {
todo!();
/*
// Compare feerate with descendants to feerate of the transaction, and
// return the fee/size for the max.
double f1 = (double)a.GetModifiedFee() * a.GetSizeWithDescendants();
double f2 = (double)a.GetModFeesWithDescendants() * a.GetTxSize();
if (f2 > f1) {
mod_fee = a.GetModFeesWithDescendants();
size = a.GetSizeWithDescendants();
} else {
mod_fee = a.GetModifiedFee();
size = a.GetTxSize();
}
*/
}
}
/**
| \class CompareTxMemPoolEntryByScore
|
| Sort by feerate of entry (fee/size)
| in descending order
|
| This is only used for transaction relay,
| so we use GetFee() instead of GetModifiedFee()
| to avoid leaking prioritization information
| via the sort order.
|
*/
pub struct CompareTxMemPoolEntryByScore {
}
impl CompareTxMemPoolEntryByScore {
pub fn invoke(&self,
a: &TxMemPoolEntry,
b: &TxMemPoolEntry) -> bool {
todo!();
/*
double f1 = (double)a.GetFee() * b.GetTxSize();
double f2 = (double)b.GetFee() * a.GetTxSize();
if (f1 == f2) {
return b.GetTx().GetHash() < a.GetTx().GetHash();
}
return f1 > f2;
*/
}
}
pub struct CompareTxMemPoolEntryByEntryTime {
}
impl CompareTxMemPoolEntryByEntryTime {
pub fn invoke(&self,
a: &TxMemPoolEntry,
b: &TxMemPoolEntry) -> bool {
todo!();
/*
return a.GetTime() < b.GetTime();
*/
}
}
/**
| \class CompareTxMemPoolEntryByAncestorScore
|
| Sort an entry by min(score/size of entry's
| tx, score/size with all ancestors).
|
*/
pub struct CompareTxMemPoolEntryByAncestorFee {
}
impl CompareTxMemPoolEntryByAncestorFee {
pub fn invoke<T>(&self, a: &T, b: &T) -> bool {
todo!();
/*
double a_mod_fee, a_size, b_mod_fee, b_size;
GetModFeeAndSize(a, a_mod_fee, a_size);
GetModFeeAndSize(b, b_mod_fee, b_size);
// Avoid division by rewriting (a/b > c/d) as (a*d > c*b).
double f1 = a_mod_fee * b_size;
double f2 = a_size * b_mod_fee;
if (f1 == f2) {
return a.GetTx().GetHash() < b.GetTx().GetHash();
}
return f1 > f2;
*/
}
/**
| Return the fee/size we're using for
| sorting this entry.
|
*/
pub fn get_mod_fee_and_size<T>(&self,
a: &T,
mod_fee: &mut f64,
size: &mut f64) {
todo!();
/*
// Compare feerate with ancestors to feerate of the transaction, and
// return the fee/size for the min.
double f1 = (double)a.GetModifiedFee() * a.GetSizeWithAncestors();
double f2 = (double)a.GetModFeesWithAncestors() * a.GetTxSize();
if (f1 > f2) {
mod_fee = a.GetModFeesWithAncestors();
size = a.GetSizeWithAncestors();
} else {
mod_fee = a.GetModifiedFee();
size = a.GetTxSize();
}
*/
}
}
pub struct CompareIteratorByHash {
}
impl CompareIteratorByHash {
/**
| SFINAE for T where T is either a pointer
| type (e.g., a txiter) or
| a reference_wrapper<T> (e.g. a wrapped
| TxMemPoolEntry&)
*/
pub fn invoke_with_refwrapper<T>(&self,
a: Amo<T>,
b: Amo<T>) -> bool {
todo!();
/*
return a.get().GetTx().GetHash() < b.get().GetTx().GetHash();
*/
}
pub fn invoke<T>(&self, a: &T, b: &T) -> bool {
todo!();
/*
return a->GetTx().GetHash() < b->GetTx().GetHash();
*/
}
}