File tree Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,13 @@ typedef struct kernel_ScriptPubkey kernel_ScriptPubkey;
123
123
*/
124
124
typedef struct kernel_TransactionOutput kernel_TransactionOutput;
125
125
126
+ /* *
127
+ * Opaque data structure for holding a transaction input.
128
+ */
129
+
130
+ typedef struct kernel_TransactionInput kernel_TransactionInput;
131
+
132
+
126
133
/* *
127
134
* Opaque data structure for holding a logging connection.
128
135
*
Original file line number Diff line number Diff line change @@ -49,6 +49,11 @@ const CBlock* cast_const_block_pointer(const kernel_BlockPointer* block_pointer)
49
49
return reinterpret_cast <const CBlock*>(block_pointer);
50
50
}
51
51
52
+ const CTransaction* cast_const_transaction (const kernel_Transaction* transaction)
53
+ {
54
+ return reinterpret_cast <const CTransaction*>(transaction);
55
+ }
56
+
52
57
kernel_blockreader_IBDStatus cast_ibd_status (IBDStatus status)
53
58
{
54
59
switch (status) {
@@ -394,5 +399,19 @@ const kernel_Transaction* kernel_block_pointer_get_transaction(const kernel_Bloc
394
399
return reinterpret_cast <const kernel_Transaction*>(block->vtx [index].get ());
395
400
}
396
401
402
+ uint32_t kernel_transaction_get_transaction_input_count (const kernel_Transaction * _transaction)
403
+ {
404
+ const auto * transaction = cast_const_transaction (_transaction);
405
+ return transaction->vin .size ();
406
+ }
407
+
408
+ const kernel_TransactionInput* kernel_transaction_get_transaction_input (const kernel_Transaction* _transaction, size_t index)
409
+ {
410
+ const auto * transaction = cast_const_transaction (_transaction);
411
+ if (index >= transaction->vin .size ()) {
412
+ return nullptr ;
413
+ }
414
+ return reinterpret_cast <const kernel_TransactionInput*>(&transaction->vin [index]);
415
+ }
397
416
398
417
} // extern "C"
Original file line number Diff line number Diff line change @@ -107,7 +107,11 @@ BITCOINKERNEL_API kernel_BlockPointer* BITCOINKERNEL_WARN_UNUSED_RESULT kernel_b
107
107
108
108
BITCOINKERNEL_API uint32_t BITCOINKERNEL_WARN_UNUSED_RESULT kernel_block_pointer_get_transaction_count (const kernel_BlockPointer* block_pointer) BITCOINKERNEL_ARG_NONNULL(1 );
109
109
110
- BITCOINKERNEL_API kernel_Transaction* BITCOINKERNEL_WARN_UNUSED_RESULT kernel_block_pointer_get_transaction (const kernel_BlockPointer* block_pointer, size_t index) BITCOINKERNEL_ARG_NONNULL(1 );
110
+ BITCOINKERNEL_API const kernel_Transaction* BITCOINKERNEL_WARN_UNUSED_RESULT kernel_block_pointer_get_transaction (const kernel_BlockPointer* block_pointer, size_t index) BITCOINKERNEL_ARG_NONNULL(1 );
111
+
112
+ BITCOINKERNEL_API uint32_t BITCOINKERNEL_WARN_UNUSED_RESULT kernel_transaction_get_transaction_input_count (const kernel_Transaction* transaction) BITCOINKERNEL_ARG_NONNULL(1 );
113
+
114
+ BITCOINKERNEL_API const kernel_TransactionInput* BITCOINKERNEL_WARN_UNUSED_RESULT kernel_transaction_get_transaction_input (const kernel_Transaction*, size_t index) BITCOINKERNEL_ARG_NONNULL(1 );
111
115
112
116
#ifdef __cplusplus
113
117
}
You can’t perform that action at this time.
0 commit comments