Commit 7c438b2
committed
transaction: Implement Coinbase type with explicit API design
We provide explicit convenience methods (compute_txid, compute_wtxid)
rather than implementing Deref to only expose methods that make sense
for coinbase transactions. This prevents inheritance of the entire
Transaction API.
inner() serves as an escape hatch when full Transaction access is needed.
This forces the user to be explicit about when they need the underlying
Transaction functionalities.
Following this approach, we avoid implicit inheritance through Deref.
We also added assume_* methods to make it clear that the caller is
responsible for ensuring the transaction is actually a coinbase transaction
in the first position of a block1 parent 6571307 commit 7c438b2
1 file changed
+36
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1169 | 1169 | | |
1170 | 1170 | | |
1171 | 1171 | | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
1172 | 1208 | | |
1173 | 1209 | | |
1174 | 1210 | | |
| |||
0 commit comments