@@ -305,6 +305,13 @@ class BitcoinTxBuilder {
305305 const std::vector<TxOut>& outputs,
306306 const std::unordered_map<std::string, std::string>& opts
307307 ) {
308+ #if defined(AILEE_BITCOIN_WRITE_DISABLED)
309+ (void )rpc; (void )outputs; (void )opts;
310+ throw std::runtime_error (
311+ " Bitcoin write operations disabled at compile time "
312+ " (AILEE_BITCOIN_WRITE_DISABLED). "
313+ " Rebuild with -DAILEE_BITCOIN_WRITE_ENABLED=ON to enable." );
314+ #else
308315 // Get UTXOs
309316 Json::Value utxosJson = rpc.call (" listunspent" , Json::Value (Json::arrayValue));
310317
@@ -365,6 +372,7 @@ class BitcoinTxBuilder {
365372 }
366373
367374 return signedTx[" hex" ].asString ();
375+ #endif
368376 }
369377};
370378
@@ -515,6 +523,20 @@ class BTCInternal {
515523 bool broadcastRaw (const std::string& rawHex,
516524 std::string& outTxId,
517525 ErrorCallback onError) {
526+ #if defined(AILEE_BITCOIN_WRITE_DISABLED)
527+ (void )rawHex; (void )outTxId;
528+ if (onError) {
529+ onError (AdapterError{
530+ Severity::Error,
531+ " Bitcoin write operations disabled at compile time "
532+ " (AILEE_BITCOIN_WRITE_DISABLED). "
533+ " Rebuild with -DAILEE_BITCOIN_WRITE_ENABLED=ON to enable." ,
534+ " Broadcast" ,
535+ -12
536+ });
537+ }
538+ return false ;
539+ #else
518540 try {
519541 // Check if already broadcast (idempotency)
520542 std::lock_guard<std::mutex> lock (broadcastMutex_);
@@ -550,6 +572,7 @@ class BTCInternal {
550572 }
551573 return false ;
552574 }
575+ #endif
553576 }
554577
555578 std::optional<NormalizedTx> fetchTx (const std::string& txid, ErrorCallback onError) {
0 commit comments