clboss/Makefile.am
Ken Sedgwick 9075ee32fc
Boltz/Detail/ClaimTxHandler.cpp: Scope claim db update to the claimed swap.
After broadcasting a reverse-swap claim transaction, the handler
recorded the claim with an UPDATE that had no WHERE clause, marking
every row in BoltzServiceFactory_rsub lockedUp=1.  Any other in-flight
swap then took the "Already broadcasted claim tx." early exit and
never broadcast its own claim; its off-chain payment stayed unsettled
until the timeout/refund path unwound it.

Add the same apiAccess + swapId predicates used by the neighboring
SELECTs and DELETE, and a regression test that seeds two swaps,
claims one, and asserts the sibling row is untouched.  The test
fails before this change and passes after.

Reported by Vincenzo Palazzo (Bitcoin Security Council / Sentinel).

Fixes #325.
2026-08-12 13:25:31 -07:00

858 lines
26 KiB
Makefile

bin_PROGRAMS = clboss
clboss_SOURCES = \
main.cpp
noinst_PROGRAMS = \
dev-boltz \
dev-boltz-api \
dev-proxy-connect
# These are the actual source files of clboss.
# We separate them here so that we can test parts of
# clboss without having to put a lot of instrumentation
# in the main file.
noinst_LTLIBRARIES = libclboss.la
libclboss_la_SOURCES = \
Bitcoin/Tx.cpp \
Bitcoin/Tx.hpp \
Bitcoin/TxId.cpp \
Bitcoin/TxId.hpp \
Bitcoin/TxIn.cpp \
Bitcoin/TxIn.hpp \
Bitcoin/TxOut.cpp \
Bitcoin/TxOut.hpp \
Bitcoin/WitnessField.cpp \
Bitcoin/WitnessField.hpp \
Bitcoin/addr_to_scriptPubKey.cpp \
Bitcoin/addr_to_scriptPubKey.hpp \
Bitcoin/hash160.cpp \
Bitcoin/hash160.hpp \
Bitcoin/le.cpp \
Bitcoin/le.hpp \
Bitcoin/sighash.cpp \
Bitcoin/sighash.hpp \
Bitcoin/varint.cpp \
Bitcoin/varint.hpp \
Boltz/Connection.hpp \
Boltz/ConnectionIF.hpp \
Boltz/Detail/ClaimTxHandler.cpp \
Boltz/Detail/ClaimTxHandler.hpp \
Boltz/Detail/FallbackConnection.cpp \
Boltz/Detail/FallbackConnection.hpp \
Boltz/Detail/NormalConnection.cpp \
Boltz/Detail/NormalConnection.hpp \
Boltz/Detail/NullConnection.cpp \
Boltz/Detail/NullConnection.hpp \
Boltz/Detail/ServiceImpl.cpp \
Boltz/Detail/ServiceImpl.hpp \
Boltz/Detail/SwapSetupHandler.cpp \
Boltz/Detail/SwapSetupHandler.hpp \
Boltz/Detail/compute_preimage.cpp \
Boltz/Detail/compute_preimage.hpp \
Boltz/Detail/create_connection.cpp \
Boltz/Detail/create_connection.hpp \
Boltz/Detail/find_lockup_outnum.cpp \
Boltz/Detail/find_lockup_outnum.hpp \
Boltz/Detail/initial_claim_tx.cpp \
Boltz/Detail/initial_claim_tx.hpp \
Boltz/Detail/match_lockscript.cpp \
Boltz/Detail/match_lockscript.hpp \
Boltz/EnvIF.hpp \
Boltz/Service.hpp \
Boltz/ServiceFactory.cpp \
Boltz/ServiceFactory.hpp \
Boltz/SwapInfo.hpp \
Boss/JsonInput.cpp \
Boss/JsonInput.hpp \
Boss/Main.cpp \
Boss/Main.hpp \
Boss/Mod/ActiveProber.cpp \
Boss/Mod/ActiveProber.hpp \
Boss/Mod/AmountSettingsHandler.cpp \
Boss/Mod/AmountSettingsHandler.hpp \
Boss/Mod/AutoDisconnector.cpp \
Boss/Mod/AutoDisconnector.hpp \
Boss/Mod/AvailableRpcCommandsAnnouncer.cpp \
Boss/Mod/AvailableRpcCommandsAnnouncer.hpp \
Boss/Mod/BlockTracker.cpp \
Boss/Mod/BlockTracker.hpp \
Boss/Mod/BoltzSwapper/Env.cpp \
Boss/Mod/BoltzSwapper/Env.hpp \
Boss/Mod/BoltzSwapper/Main.cpp \
Boss/Mod/BoltzSwapper/Main.hpp \
Boss/Mod/BoltzSwapper/ServiceCreator.cpp \
Boss/Mod/BoltzSwapper/ServiceCreator.hpp \
Boss/Mod/BoltzSwapper/ServiceModule.cpp \
Boss/Mod/BoltzSwapper/ServiceModule.hpp \
Boss/Mod/ChannelFeeManager.cpp \
Boss/Mod/ChannelFeeManager.hpp \
Boss/Mod/CommandReceiver.cpp \
Boss/Mod/CommandReceiver.hpp \
Boss/Mod/ChannelCandidateInvestigator/Gumshoe.cpp \
Boss/Mod/ChannelCandidateInvestigator/Gumshoe.hpp \
Boss/Mod/ChannelCandidateInvestigator/Janitor.cpp \
Boss/Mod/ChannelCandidateInvestigator/Janitor.hpp \
Boss/Mod/ChannelCandidateInvestigator/Main.cpp \
Boss/Mod/ChannelCandidateInvestigator/Main.hpp \
Boss/Mod/ChannelCandidateInvestigator/Manager.cpp \
Boss/Mod/ChannelCandidateInvestigator/Manager.hpp \
Boss/Mod/ChannelCandidateInvestigator/Secretary.cpp \
Boss/Mod/ChannelCandidateInvestigator/Secretary.hpp \
Boss/Mod/ChannelCandidateMatchmaker.cpp \
Boss/Mod/ChannelCandidateMatchmaker.hpp \
Boss/Mod/ChannelCandidatePreinvestigator.cpp \
Boss/Mod/ChannelCandidatePreinvestigator.hpp \
Boss/Mod/ChannelCreateDestroyMonitor.cpp \
Boss/Mod/ChannelCreateDestroyMonitor.hpp \
Boss/Mod/ChannelCreationDecider.cpp \
Boss/Mod/ChannelCreationDecider.hpp \
Boss/Mod/ChannelCreator/Carpenter.cpp \
Boss/Mod/ChannelCreator/Carpenter.hpp \
Boss/Mod/ChannelCreator/Main.cpp \
Boss/Mod/ChannelCreator/Main.hpp \
Boss/Mod/ChannelCreator/Manager.cpp \
Boss/Mod/ChannelCreator/Manager.hpp \
Boss/Mod/ChannelCreator/Planner.cpp \
Boss/Mod/ChannelCreator/Planner.hpp \
Boss/Mod/ChannelCreator/RearrangerBySize.cpp \
Boss/Mod/ChannelCreator/RearrangerBySize.hpp \
Boss/Mod/ChannelCreator/Reprioritizer.cpp \
Boss/Mod/ChannelCreator/Reprioritizer.hpp \
Boss/Mod/ChannelFeeSetter.cpp \
Boss/Mod/ChannelFeeSetter.hpp \
Boss/Mod/ChannelFinderByDistance.cpp \
Boss/Mod/ChannelFinderByDistance.hpp \
Boss/Mod/ChannelFinderByEarnedFee.cpp \
Boss/Mod/ChannelFinderByEarnedFee.hpp \
Boss/Mod/ChannelFinderByListpays.cpp \
Boss/Mod/ChannelFinderByListpays.hpp \
Boss/Mod/ChannelFinderByPopularity.cpp \
Boss/Mod/ChannelFinderByPopularity.hpp \
Boss/Mod/ChannelFundsComputer.cpp \
Boss/Mod/ChannelFundsComputer.hpp \
Boss/Mod/ComplainerByLowConnectRate.cpp \
Boss/Mod/ComplainerByLowConnectRate.hpp \
Boss/Mod/ComplainerByLowSuccessPerDay.cpp \
Boss/Mod/ComplainerByLowSuccessPerDay.hpp \
Boss/Mod/ConnectFinderByDns.cpp \
Boss/Mod/ConnectFinderByDns.hpp \
Boss/Mod/ConnectFinderByHardcode.cpp \
Boss/Mod/ConnectFinderByHardcode.hpp \
Boss/Mod/Connector.cpp \
Boss/Mod/Connector.hpp \
Boss/Mod/ConstructedListpeers.cpp \
Boss/Mod/ConstructedListpeers.hpp \
Boss/Mod/Dowser.cpp \
Boss/Mod/Dowser.hpp \
Boss/Mod/EarningsRebalancer.cpp \
Boss/Mod/EarningsRebalancer.hpp \
Boss/Mod/EarningsTracker.cpp \
Boss/Mod/EarningsTracker.hpp \
Boss/Mod/FeeModderByBalance.cpp \
Boss/Mod/FeeModderByBalance.hpp \
Boss/Mod/FeeMonitor.cpp \
Boss/Mod/FeeMonitor.hpp \
Boss/Mod/FeeModderByPriceTheory.cpp \
Boss/Mod/FeeModderByPriceTheory.hpp \
Boss/Mod/FeeModderBySize.cpp \
Boss/Mod/FeeModderBySize.hpp \
Boss/Mod/ForwardFeeMonitor.cpp \
Boss/Mod/ForwardFeeMonitor.hpp \
Boss/Mod/FundsMover/Attempter.cpp \
Boss/Mod/FundsMover/Attempter.hpp \
Boss/Mod/FundsMover/Claimer.cpp \
Boss/Mod/FundsMover/Claimer.hpp \
Boss/Mod/FundsMover/Main.cpp \
Boss/Mod/FundsMover/Main.hpp \
Boss/Mod/FundsMover/Runner.cpp \
Boss/Mod/FundsMover/Runner.hpp \
Boss/Mod/FundsMover/create_label.cpp \
Boss/Mod/FundsMover/create_label.hpp \
Boss/Mod/HtlcAcceptor.cpp \
Boss/Mod/HtlcAcceptor.hpp \
Boss/Mod/InitialConnect.cpp \
Boss/Mod/InitialConnect.hpp \
Boss/Mod/InitialRebalancer.cpp \
Boss/Mod/InitialRebalancer.hpp \
Boss/Mod/Initiator.cpp \
Boss/Mod/Initiator.hpp \
Boss/Mod/InternetConnectionMonitor.cpp \
Boss/Mod/InternetConnectionMonitor.hpp \
Boss/Mod/InvoicePayer.cpp \
Boss/Mod/InvoicePayer.hpp \
Boss/Mod/JitRebalancer.cpp \
Boss/Mod/JitRebalancer.hpp \
Boss/Mod/JsonOutputter.cpp \
Boss/Mod/JsonOutputter.hpp \
Boss/Mod/ListfundsAnalyzer.cpp \
Boss/Mod/ListfundsAnalyzer.hpp \
Boss/Mod/ListfundsAnnouncer.cpp \
Boss/Mod/ListfundsAnnouncer.hpp \
Boss/Mod/ListpaysHandler.cpp \
Boss/Mod/ListpaysHandler.hpp \
Boss/Mod/ListpeersAnalyzer.cpp \
Boss/Mod/ListpeersAnalyzer.hpp \
Boss/Mod/ListpeersAnnouncer.cpp \
Boss/Mod/ListpeersAnnouncer.hpp \
Boss/Mod/Manifester.cpp \
Boss/Mod/Manifester.hpp \
Boss/Mod/MoveFundsCommand.cpp \
Boss/Mod/MoveFundsCommand.hpp \
Boss/Mod/NeedsConnectSolicitor.cpp \
Boss/Mod/NeedsConnectSolicitor.hpp \
Boss/Mod/NeedsOnchainFundsSwapper.cpp \
Boss/Mod/NeedsOnchainFundsSwapper.hpp \
Boss/Mod/NewaddrHandler.cpp \
Boss/Mod/NewaddrHandler.hpp \
Boss/Mod/NodeBalanceSwapper.cpp \
Boss/Mod/NodeBalanceSwapper.hpp \
Boss/Mod/OnchainFeeMonitor.cpp \
Boss/Mod/OnchainFeeMonitor.hpp \
Boss/Mod/OnchainFundsAnnouncer.cpp \
Boss/Mod/OnchainFundsAnnouncer.hpp \
Boss/Mod/OnchainFundsIgnorer.cpp \
Boss/Mod/OnchainFundsIgnorer.hpp \
Boss/Mod/PaymentDeleter.cpp \
Boss/Mod/PaymentDeleter.hpp \
Boss/Mod/PeerCompetitorFeeMonitor/Main.cpp \
Boss/Mod/PeerCompetitorFeeMonitor/Main.hpp \
Boss/Mod/PeerCompetitorFeeMonitor/Surveyor.cpp \
Boss/Mod/PeerCompetitorFeeMonitor/Surveyor.hpp \
Boss/Mod/PeerComplaintsDesk/Exempter.cpp \
Boss/Mod/PeerComplaintsDesk/Exempter.hpp \
Boss/Mod/PeerComplaintsDesk/Main.cpp \
Boss/Mod/PeerComplaintsDesk/Main.hpp \
Boss/Mod/PeerComplaintsDesk/Recorder.cpp \
Boss/Mod/PeerComplaintsDesk/Recorder.hpp \
Boss/Mod/PeerComplaintsDesk/Unmanager.cpp \
Boss/Mod/PeerComplaintsDesk/Unmanager.hpp \
Boss/Mod/PeerFromScidMapper.cpp \
Boss/Mod/PeerFromScidMapper.hpp \
Boss/Mod/PeerJudge/AgeTracker.cpp \
Boss/Mod/PeerJudge/AgeTracker.hpp \
Boss/Mod/PeerJudge/Algo.cpp \
Boss/Mod/PeerJudge/Algo.hpp \
Boss/Mod/PeerJudge/DataGatherer.cpp \
Boss/Mod/PeerJudge/DataGatherer.hpp \
Boss/Mod/PeerJudge/Executioner.cpp \
Boss/Mod/PeerJudge/Executioner.hpp \
Boss/Mod/PeerJudge/Info.hpp \
Boss/Mod/PeerJudge/Unmanager.cpp \
Boss/Mod/PeerJudge/Unmanager.hpp \
Boss/Mod/PeerMetrician.cpp \
Boss/Mod/PeerMetrician.hpp \
Boss/Mod/PeerStatistician.cpp \
Boss/Mod/PeerStatistician.hpp \
Boss/Mod/Reconnector.cpp \
Boss/Mod/Reconnector.hpp \
Boss/Mod/RegularActiveProbe.cpp \
Boss/Mod/RegularActiveProbe.hpp \
Boss/Mod/Rpc.cpp \
Boss/Mod/Rpc.hpp \
Boss/Mod/RpcWrapper.cpp \
Boss/Mod/RpcWrapper.hpp \
Boss/Mod/RebalanceUnmanager.cpp \
Boss/Mod/RebalanceUnmanager.hpp \
Boss/Mod/SelfUptimeMonitor.cpp \
Boss/Mod/SelfUptimeMonitor.hpp \
Boss/Mod/SendpayResultMonitor.cpp \
Boss/Mod/SendpayResultMonitor.hpp \
Boss/Mod/StatusCommand.cpp \
Boss/Mod/StatusCommand.hpp \
Boss/Mod/SwapManager.cpp \
Boss/Mod/SwapManager.hpp \
Boss/Mod/SwapReporter.cpp \
Boss/Mod/SwapReporter.hpp \
Boss/Mod/TimerTwiceDailyAnnouncer.cpp \
Boss/Mod/TimerTwiceDailyAnnouncer.hpp \
Boss/Mod/Timers.cpp \
Boss/Mod/Timers.hpp \
Boss/Mod/UnmanagedManager.cpp \
Boss/Mod/UnmanagedManager.hpp \
Boss/Mod/Waiter.cpp \
Boss/Mod/Waiter.hpp \
Boss/Mod/all.cpp \
Boss/Mod/all.hpp \
Boss/ModG/Detail/ReqRespBase.cpp \
Boss/ModG/Detail/ReqRespBase.hpp \
Boss/ModG/ReqResp.hpp \
Boss/ModG/RpcProxy.cpp \
Boss/ModG/RpcProxy.hpp \
Boss/ModG/RebalanceUnmanagerProxy.hpp \
Boss/ModG/Swapper.cpp \
Boss/ModG/Swapper.hpp \
Boss/Msg/AcceptSwapQuotation.hpp \
Boss/Msg/AmountSettings.hpp \
Boss/Msg/AvailableRpcCommands.hpp \
Boss/Msg/Begin.hpp \
Boss/Msg/Block.hpp \
Boss/Msg/ChannelCreateResult.hpp \
Boss/Msg/ChannelCreation.hpp \
Boss/Msg/ChannelDestruction.hpp \
Boss/Msg/ChannelFunds.hpp \
Boss/Msg/CommandFail.hpp \
Boss/Msg/CommandRequest.hpp \
Boss/Msg/CommandResponse.hpp \
Boss/Msg/DbResource.hpp \
Boss/Msg/MonitorFeeByBalance.hpp \
Boss/Msg/MonitorFeeByTheory.hpp \
Boss/Msg/MonitorFeeSetChannel.hpp \
Boss/Msg/MonitorFeeBySize.hpp \
Boss/Msg/EndOfOptions.hpp \
Boss/Msg/ForwardFee.hpp \
Boss/Msg/Init.hpp \
Boss/Msg/InternetOnline.hpp \
Boss/Msg/JsonCin.hpp \
Boss/Msg/JsonCout.hpp \
Boss/Msg/ListfundsAnalyzedResult.hpp \
Boss/Msg/ListfundsResult.hpp \
Boss/Msg/ListpeersAnalyzedResult.hpp \
Boss/Msg/ListpeersResult.hpp \
Boss/Msg/ManifestCommand.hpp \
Boss/Msg/ManifestHook.hpp \
Boss/Msg/ManifestNotification.hpp \
Boss/Msg/ManifestOption.hpp \
Boss/Msg/Manifestation.hpp \
Boss/Msg/NeedsConnect.hpp \
Boss/Msg/NeedsOnchainFunds.hpp \
Boss/Msg/Network.hpp \
Boss/Msg/Notification.hpp \
Boss/Msg/OnchainFee.hpp \
Boss/Msg/OnchainFunds.hpp \
Boss/Msg/Option.hpp \
Boss/Msg/OptionType.hpp \
Boss/Msg/PatronizeChannelCandidate.hpp \
Boss/Msg/PayInvoice.hpp \
Boss/Msg/PeerMedianChannelFee.hpp \
Boss/Msg/PeerMetrics.hpp \
Boss/Msg/PeerStatistics.hpp \
Boss/Msg/PreinvestigateChannelCandidates.hpp \
Boss/Msg/ProbeActively.hpp \
Boss/Msg/ProposeChannelCandidates.hpp \
Boss/Msg/ProposeConnectCandidates.hpp \
Boss/Msg/ProposePatronlessChannelCandidate.hpp \
Boss/Msg/ProvideChannelFeeModifier.hpp \
Boss/Msg/ProvideDeletablePaymentLabelFilter.hpp \
Boss/Msg/ProvideHtlcAcceptedDeferrer.hpp \
Boss/Msg/ProvideStatus.hpp \
Boss/Msg/ProvideSwapQuotation.hpp \
Boss/Msg/ProvideUnmanagement.hpp \
Boss/Msg/RaisePeerComplaint.hpp \
Boss/Msg/ReleaseHtlcAccepted.hpp \
Boss/Msg/ReqRespTraits.hpp \
Boss/Msg/RequestChannelCreation.hpp \
Boss/Msg/RequestConnect.hpp \
Boss/Msg/RequestDowser.hpp \
Boss/Msg/RequestEarningsInfo.hpp \
Boss/Msg/RequestGetOnchainIgnoreFlag.hpp \
Boss/Msg/RequestListpays.hpp \
Boss/Msg/RequestMoveFunds.hpp \
Boss/Msg/RequestNewaddr.hpp \
Boss/Msg/RequestPeerFromScid.hpp \
Boss/Msg/RequestPeerMetrics.hpp \
Boss/Msg/RequestPeerStatistics.hpp \
Boss/Msg/RequestRebalanceUnmanaged.hpp \
Boss/Msg/RequestRpcCommand.hpp \
Boss/Msg/RequestSelfUptime.hpp \
Boss/Msg/ResponseConnect.hpp \
Boss/Msg/ResponseDowser.hpp \
Boss/Msg/ResponseEarningsInfo.hpp \
Boss/Msg/ResponseGetOnchainIgnoreFlag.hpp \
Boss/Msg/ResponseListpays.hpp \
Boss/Msg/ResponseMoveFunds.hpp \
Boss/Msg/ResponseNewaddr.hpp \
Boss/Msg/ResponsePeerFromScid.hpp \
Boss/Msg/ResponsePeerMetrics.hpp \
Boss/Msg/ResponsePeerStatistics.hpp \
Boss/Msg/ResponseRebalanceUnmanaged.hpp \
Boss/Msg/ResponseRpcCommand.hpp \
Boss/Msg/ResponseSelfUptime.hpp \
Boss/Msg/RpcCommandHook.hpp \
Boss/Msg/SendpayResult.hpp \
Boss/Msg/SetChannelFee.hpp \
Boss/Msg/SolicitChannelCandidates.hpp \
Boss/Msg/SolicitChannelFeeModifier.hpp \
Boss/Msg/SolicitConnectCandidates.hpp \
Boss/Msg/SolicitDeletablePaymentLabelFilter.hpp \
Boss/Msg/SolicitHtlcAcceptedDeferrer.hpp \
Boss/Msg/SolicitPeerComplaints.hpp \
Boss/Msg/SolicitStatus.hpp \
Boss/Msg/SolicitSwapQuotation.hpp \
Boss/Msg/SolicitUnmanagement.hpp \
Boss/Msg/StatusListpays.hpp \
Boss/Msg/SwapCompleted.hpp \
Boss/Msg/SwapCreation.hpp \
Boss/Msg/SwapRequest.hpp \
Boss/Msg/SwapResponse.hpp \
Boss/Msg/TaskCompletion.hpp \
Boss/Msg/Timer10Minutes.hpp \
Boss/Msg/TimerRandomDaily.hpp \
Boss/Msg/TimerRandomHourly.hpp \
Boss/Msg/TimerTwiceDaily.hpp \
Boss/Shutdown.hpp \
Boss/Signer.cpp \
Boss/Signer.hpp \
Boss/concurrent.cpp \
Boss/concurrent.hpp \
Boss/log.cpp \
Boss/log.hpp \
Boss/random_engine.cpp \
Boss/random_engine.hpp \
Boss/open_rpc_socket.cpp \
Boss/open_rpc_socket.hpp \
DnsSeed/Detail/decode_bech32_node.cpp \
DnsSeed/Detail/decode_bech32_node.hpp \
DnsSeed/Detail/parse_dig_srv.cpp \
DnsSeed/Detail/parse_dig_srv.hpp \
DnsSeed/get.cpp \
DnsSeed/get.hpp \
Ev/Io.hpp \
Ev/Semaphore.cpp \
Ev/Semaphore.hpp \
Ev/ThreadPool.cpp \
Ev/ThreadPool.hpp \
Ev/concurrent.cpp \
Ev/concurrent.hpp \
Ev/coroutine.cpp \
Ev/coroutine.hpp \
Ev/foreach.hpp \
Ev/map.hpp \
Ev/memoize.hpp \
Ev/now.cpp \
Ev/now.hpp \
Ev/runcmd.cpp \
Ev/runcmd.hpp \
Ev/start.cpp \
Ev/start.hpp \
Ev/yield.cpp \
Ev/yield.hpp \
Graph/Dijkstra.hpp \
Graph/TreeNode.hpp \
Jsmn/Detail/DatumIdentifier.hpp \
Jsmn/Detail/Iterator.cpp \
Jsmn/Detail/Iterator.hpp \
Jsmn/Detail/ParseResult.hpp \
Jsmn/Detail/Str.cpp \
Jsmn/Detail/Str.hpp \
Jsmn/Detail/Token.cpp \
Jsmn/Detail/Token.hpp \
Jsmn/Detail/Type.hpp \
Jsmn/Object.cpp \
Jsmn/Object.hpp \
Jsmn/ParseError.cpp \
Jsmn/ParseError.hpp \
Jsmn/Parser.hpp \
Jsmn/ParserExposedBuffer.cpp \
Jsmn/ParserExposedBuffer.hpp \
Jsmn/jsonify_string.cpp \
Jsmn/jsonify_string.hpp \
Json/Out.hpp \
Ln/Amount.cpp \
Ln/Amount.hpp \
Ln/CommandId.cpp \
Ln/CommandId.hpp \
Ln/HtlcAccepted.cpp \
Ln/HtlcAccepted.hpp \
Ln/NodeId.cpp \
Ln/NodeId.hpp \
Ln/Preimage.cpp \
Ln/Preimage.hpp \
Ln/Scid.cpp \
Ln/Scid.hpp \
Net/Connector.hpp \
Net/Detail/AddrInfoReleaser.cpp \
Net/Detail/AddrInfoReleaser.hpp \
Net/DirectConnector.cpp \
Net/DirectConnector.hpp \
Net/Fd.cpp \
Net/Fd.hpp \
Net/IPAddr.cpp \
Net/IPAddr.hpp \
Net/IPAddrOrOnion.cpp \
Net/IPAddrOrOnion.hpp \
Net/IPBinnerBySubnet.cpp \
Net/IPBinnerBySubnet.hpp \
Net/IPBinnerIF.hpp \
Net/ProxyConnector.cpp \
Net/ProxyConnector.hpp \
Net/SocketFd.cpp \
Net/SocketFd.hpp \
Net/get_bin_of_onion.cpp \
Net/get_bin_of_onion.hpp \
Ripemd160/Hash.cpp \
Ripemd160/Hash.hpp \
Ripemd160/Hasher.cpp \
Ripemd160/Hasher.hpp \
S/Bus.cpp \
S/Bus.hpp \
S/Detail/Signal.hpp \
S/Detail/SignalBase.hpp \
Secp256k1/Detail/context.cpp \
Secp256k1/Detail/context.hpp \
Secp256k1/G.cpp \
Secp256k1/G.hpp \
Secp256k1/KeyPair.hpp \
Secp256k1/PrivKey.cpp \
Secp256k1/PrivKey.hpp \
Secp256k1/PubKey.cpp \
Secp256k1/PubKey.hpp \
Secp256k1/Random.cpp \
Secp256k1/Random.hpp \
Secp256k1/Signature.cpp \
Secp256k1/Signature.hpp \
Secp256k1/SignerIF.hpp \
Sha256/Hash.cpp \
Sha256/Hash.hpp \
Sha256/Hasher.cpp \
Sha256/Hasher.hpp \
Sha256/HasherStream.cpp \
Sha256/HasherStream.hpp \
Sha256/fun.hpp \
Sqlite3.hpp \
Sqlite3/Db.cpp \
Sqlite3/Db.hpp \
Sqlite3/Detail/binds.cpp \
Sqlite3/Detail/binds.hpp \
Sqlite3/Detail/columns.cpp \
Sqlite3/Detail/columns.hpp \
Sqlite3/Query.cpp \
Sqlite3/Query.hpp \
Sqlite3/Result.cpp \
Sqlite3/Result.hpp \
Sqlite3/Tx.cpp \
Sqlite3/Tx.hpp \
Stats/ReservoirSampler.hpp \
Stats/RunningMean.cpp \
Stats/RunningMean.hpp \
Stats/WeightedMedian.hpp \
Util/BacktraceException.hpp \
Util/Bech32.cpp \
Util/Bech32.hpp \
Util/Compiler.hpp \
Util/Either.hpp \
Util/Rw.cpp \
Util/Rw.hpp \
Util/Str.cpp \
Util/Str.hpp \
Util/date.cpp \
Util/date.hpp \
Util/duration.cpp \
Util/duration.hpp \
Util/format.cpp \
Util/format.hpp \
Util/make_unique.hpp \
Util/stringify.hpp \
Util/stream_elements.hpp \
Util/vector_emplace_back.hpp \
Uuid.cpp \
Uuid.hpp
libclboss_la_LIBADD = \
external/basicsecure/libbasicsecure.la \
external/bitcoin-ripemd160/libbitcoin-ripemd160.la \
external/bitcoin-sha256/libbitcoin-sha256.la \
external/secp256k1/libsecp256k1.la
libclboss_la_CPPFLAGS = \
-I$(top_srcdir)/external/basicsecure/ \
-I$(top_srcdir)/external/bitcoin-ripemd160/ \
-I$(top_srcdir)/external/bitcoin-sha256/ \
-I$(top_srcdir)/external/secp256k1/include/ \
-I$(top_srcdir)/external/jsmn
dev_boltz_CPPFLAGS = \
-I$(top_srcdir)/external/basicsecure/
# Externals
SUBDIRS = \
external/basicsecure \
external/bitcoin-ripemd160 \
external/bitcoin-sha256 \
external/secp256k1/
EXTRA_DIST = \
create-tarball.in \
external/jsmn/LICENSE \
external/jsmn/jsmn.h \
new-mod \
reproducible/README.md \
reproducible/build.sh \
reproducible/continue.sh \
reproducible/manifest.scm.template \
generate_commit_hash.sh \
commit_hash.h
AM_CXXFLAGS = -Wall -Werror $(PTHREAD_CFLAGS) $(libev_CFLAGS) $(SQLITE3_CFLAGS) $(CURL_CFLAGS) $(CLBOSS_CXXFLAGS)
LDADD = libclboss.la $(PTHREAD_LIBS) $(libev_LIBS) $(SQLITE3_LIBS) $(CURL_LIBS)
if ENABLE_EXCEPTION_BACKTRACE
AM_CXXFLAGS += -DENABLE_EXCEPTION_BACKTRACE $(LIBUNWIND_CFLAGS)
LDADD += $(LIBUNWIND_LIBS)
endif
ACLOCAL_AMFLAGS = -I m4
AM_DEFAULT_SOURCE_EXT = .cpp
TESTS = \
tests/bitcoin/test_addr_to_scriptpubkey \
tests/bitcoin/test_serial \
tests/bitcoin/test_sighash \
tests/bitcoin/test_tx \
tests/boltz/test_claimtxhandler_scoped_update \
tests/boltz/test_match_lockscript \
tests/boss/channelcandidateinvestigator/test_gumshoe \
tests/boss/channelcandidateinvestigator/test_secretary \
tests/boss/test_availablerpccommandsannouncer \
tests/boss/test_channel_create_destroy_monitor_missing_old_state \
tests/boss/test_channelcreationdecider \
tests/boss/test_channelcreator_planner \
tests/boss/test_channelcreator_rearrangerbysize \
tests/boss/test_channelcreator_reprioritizer \
tests/boss/test_earningsrebalancer \
tests/boss/test_earningstracker \
tests/boss/test_feemon_history \
tests/boss/test_feemodderbypricetheory \
tests/boss/test_forwardfeemonitor \
tests/boss/test_getmanifest \
tests/boss/test_invoicepayer_decodepay \
tests/boss/test_initialrebalancer \
tests/boss/test_initiator_listconfigs_proxy \
tests/boss/test_jitrebalancer \
tests/boss/test_needsconnectsolicitor \
tests/boss/test_onchainfeemonitor_samples_init \
tests/boss/test_peerjudge_agetracker \
tests/boss/test_recentearnings \
tests/boss/test_earningshistory \
tests/boss/test_peerjudge_algo \
tests/boss/test_peerjudge_datagatherer \
tests/boss/test_peerstatistician \
tests/boss/test_peercomplaintsdesk_recorder \
tests/boss/test_reqresp \
tests/boss/test_rpc \
tests/boss/test_stringid \
tests/boss/test_swapmanager \
tests/boss/test_unmanagedmanager \
tests/boss/test_version \
tests/boss/test_waiter_timed \
tests/dnsseed/test_decode_bech32_node \
tests/dnsseed/test_get \
tests/dnsseed/test_parse_dig_srv \
tests/ev/test_concurrent_simple \
tests/ev/test_io_mem_leak \
tests/ev/test_map \
tests/ev/test_memoize \
tests/ev/test_plus \
tests/ev/test_coroutine_cleanup \
tests/ev/test_coroutine_unattached_leak \
tests/ev/test_coroutine_attached_before_finalize \
tests/ev/test_coroutine_io_gone_before_finalize \
tests/ev/test_runcmd \
tests/ev/test_semaphore \
tests/ev/test_throw_in_then \
tests/graph/test_dijkstra \
tests/jsmn/test_equality \
tests/jsmn/test_iterator \
tests/jsmn/test_parser \
tests/jsmn/test_performance \
tests/json/test_out_simple \
tests/ln/test_amount \
tests/ln/test_commandid \
tests/ln/test_htlcaccepted \
tests/ln/test_nodeid \
tests/ln/test_scid \
tests/net/test_ipaddr \
tests/net/test_ipaddroronion \
tests/ripemd160/test_ripemd160 \
tests/s/test_bus \
tests/sha256/test_hash \
tests/sha256/test_hasher \
tests/sqlite3/test_sqlite3 \
tests/stats/test_reservoir_sampler \
tests/stats/test_running_mean \
tests/stats/test_weighted_median \
tests/test_uuid \
tests/util/test_date \
tests/util/test_duration \
tests/util/test_either \
tests/util/test_format
check_PROGRAMS = $(TESTS)
if USE_VALGRIND
LOG_COMPILER = valgrind
AM_LOG_FLAGS = --leak-check=full --error-exitcode=1
AM_CXXFLAGS += -DUSE_VALGRIND
endif
# Reproducible tarball
# NOTE: this still requires us to nail down the
# version of `autoconf-archive`, `automake`,
# `autoconf`, and `libtool`.
my__tar = tar --format=ustar --mtime='1970-01-01 00:00Z' --sort=name --owner=0 --group=0 --numeric-owner -chf - "$$tardir"
dist-gzip: distdir
tardir=$(distdir) && $(my__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
@sha256sum $(distdir).tar.gz || true
$(am__post_remove_distdir)
# Utility script
noinst_SCRIPTS = \
create-tarball
CLEANFILES = $(noinst_SCRIPTS)
create-tarball: create-tarball.in Makefile
sed -e 's/[@]PACKAGE_VERSION[@]/$(PACKAGE_VERSION)/' < $(srcdir)/create-tarball.in > create-tarball
chmod +x create-tarball
BUILT_SOURCES = commit_hash.h
# Developer helper: regenerate compile_commands.json with bear.
.PHONY: compile_commands.json bear-compile-commands
compile_commands.json bear-compile-commands:
@if ! command -v bear >/dev/null 2>&1; then \
echo "bear not found; install it to generate compile_commands.json." >&2; \
exit 1; \
fi
rm -f compile_commands.json
$(MAKE) clean
bear --output compile_commands.json -- $(MAKE) all
.PHONY: coverage coverage-clean coverage-report
COVERAGE_CFLAGS ?= -Og --coverage
COVERAGE_CXXFLAGS ?= -Og --coverage
COVERAGE_LDFLAGS ?= --coverage
LCOV ?= lcov
GENHTML ?= genhtml
GCOV ?= gcov
coverage-clean:
rm -f coverage.info
rm -rf coverage-html
find . \( \
-name '*.gcda' -o \
-name '*.gcno' -o \
-name '*.gcov' -o \
-name '*.gcov.json.gz' \
\) -exec rm -f {} +
coverage:
$(MAKE) coverage-clean
$(MAKE) distclean || true
autoreconf -fi
./configure \
--disable-valgrind \
CFLAGS='$(COVERAGE_CFLAGS)' \
CXXFLAGS='$(COVERAGE_CXXFLAGS)' \
LDFLAGS='$(COVERAGE_LDFLAGS)'
$(MAKE) -j$$(nproc)
$(MAKE) -j$$(nproc) check-TESTS
@if command -v "$(LCOV)" >/dev/null 2>&1; then \
$(MAKE) coverage-report; \
else \
echo "$(LCOV) not found; skipping coverage report." >&2; \
echo "Install it (e.g. apt install lcov) or run: nix shell nixpkgs#lcov --command make coverage-report" >&2; \
fi
coverage-report:
@if ! command -v $(LCOV) >/dev/null 2>&1; then \
echo "$(LCOV) not found; install it (e.g. apt install lcov) or run via: nix shell nixpkgs#lcov" >&2; \
exit 1; \
fi
$(LCOV) --gcov-tool "$(GCOV)" --capture \
--no-external \
--ignore-errors source \
--directory . \
--base-directory "$(abs_top_srcdir)" \
--output-file coverage.info \
|| $(LCOV) --gcov-tool "$(GCOV)" --capture \
--no-external \
--ignore-errors inconsistent,source \
--directory . \
--base-directory "$(abs_top_srcdir)" \
--output-file coverage.info \
|| $(LCOV) --gcov-tool "$(GCOV)" --capture \
--no-external \
--directory . \
--base-directory "$(abs_top_srcdir)" \
--output-file coverage.info
$(LCOV) --remove coverage.info \
'*/external/*' \
'*/tests/*' \
'*/crypto/*' \
'*/src/*' \
'*/basicsecure.c' \
'/usr/*' \
'/nix/store/*' \
--ignore-errors unused \
--output-file coverage.info \
|| $(LCOV) --remove coverage.info \
'*/external/*' \
'*/tests/*' \
'*/crypto/*' \
'*/src/*' \
'*/basicsecure.c' \
'/usr/*' \
'/nix/store/*' \
--output-file coverage.info
$(LCOV) --summary coverage.info
$(GENHTML) coverage.info \
--filter missing \
--ignore-errors inconsistent,corrupt \
--legend \
--title "clboss coverage" \
--output-directory coverage-html \
|| $(GENHTML) coverage.info \
--ignore-errors source \
--legend \
--title "clboss coverage" \
--output-directory coverage-html \
|| $(GENHTML) coverage.info \
--legend \
--title "clboss coverage" \
--output-directory coverage-html
commit_hash.h: FORCE
@if git -C $(srcdir) rev-parse --is-inside-work-tree > /dev/null 2>&1; then \
CURRENT_HASH="$$(git -C $(srcdir) rev-parse HEAD)"; \
if [ ! -f $(srcdir)/commit_hash.h ] || \
[ "$$(grep -oE '[0-9a-f]{40}' $(srcdir)/commit_hash.h)" != "$$CURRENT_HASH" ]; then \
echo "Regenerating $(srcdir)/commit_hash.h..."; \
$(SHELL) $(srcdir)/generate_commit_hash.sh; \
else \
echo "$(srcdir)/commit_hash.h is up-to-date."; \
fi \
else \
if [ ! -f $(srcdir)/commit_hash.h ]; then \
echo "Error: commit_hash.h is missing.!!!"; \
echo "Maybe you need the other release tarball?"; \
echo "(the one named \"Source code\" is **NOT** the one you want ...)"; \
exit 1; \
else \
echo "Using existing $(srcdir)/commit_hash.h"; \
fi \
fi
# Ensure that commit_hash.h is included in the source tarball.
dist-hook:
test -f $(srcdir)/commit_hash.h || $(MAKE) commit_hash.h
test -f $(distdir)/commit_hash.h || cp $(srcdir)/commit_hash.h $(distdir)/
FORCE:
.PHONY: FORCE install-versioned
CLBOSS_VERSIONED_SYMLINK ?= clboss
CLBOSS_VERSIONED_DESCRIBE ?=
install-versioned: all
@set -e; \
describe="$(CLBOSS_VERSIONED_DESCRIBE)"; \
if [ -z "$$describe" ]; then \
if git -C "$(srcdir)" rev-parse --is-inside-work-tree > /dev/null 2>&1; then \
describe="$$(git -C "$(srcdir)" describe --tags --always --dirty)"; \
else \
describe="v$(PACKAGE_VERSION)"; \
fi; \
fi; \
bindir_path="$(DESTDIR)$(bindir)"; \
$(MKDIR_P) "$$bindir_path"; \
$(INSTALL_PROGRAM) clboss "$$bindir_path/clboss-$$describe"; \
rm -f "$$bindir_path/$(CLBOSS_VERSIONED_SYMLINK)"; \
ln -s "clboss-$$describe" "$$bindir_path/$(CLBOSS_VERSIONED_SYMLINK)"; \
echo "Installed $$bindir_path/clboss-$$describe and set $$bindir_path/$(CLBOSS_VERSIONED_SYMLINK)"
clboss libclboss.la: $(BUILT_SOURCES)