Documentation
¶
Index ¶
- Constants
- func API(t *testing.T, database *sql.DB, options ...ServerOpt) (connect.HTTPClient, string)
- func CoreWalletOrchestrator(t *testing.T) orchrpc.WalletManagerServiceClient
- func ExpectCoreWalletSetup(mock *mocks.MockBitcoinServiceClient)
- func ExpectOrchestratorReads(mock *mocks.MockWalletManagerServiceClient)
- func ExpectOrchestratorReadsWithoutFrozenCoins(mock *mocks.MockWalletManagerServiceClient)
- type ServerOpt
- func WithBitcoind(bitcoind bitcoindv1alphaconnect.BitcoinServiceClient) ServerOpt
- func WithBlockProducer(producer mainchainv1connect.BlockProducerServiceClient) ServerOpt
- func WithCoreWallet() ServerOpt
- func WithCrypto(crypto cryptov1connect.CryptoServiceClient) ServerOpt
- func WithEncryptedWallet() ServerOpt
- func WithLocalAuth(dir string) ServerOpt
- func WithNetwork(network config.Network) ServerOpt
- func WithOrchestrator(client orchrpc.WalletManagerServiceClient) ServerOpt
- func WithPasswordWallet() ServerOpt
- func WithValidator(validator mainchainv1connect.ValidatorServiceClient) ServerOpt
- func WithWatchOnlyWallet() ServerOpt
Constants ¶
const EncryptedWalletPassword = "correct horse"
EncryptedWalletPassword opens the fixture wallet of WithPasswordWallet.
Variables ¶
This section is empty.
Functions ¶
func CoreWalletOrchestrator ¶
func CoreWalletOrchestrator(t *testing.T) orchrpc.WalletManagerServiceClient
CoreWalletOrchestrator returns an orchestrator client that names the Bitcoin Core wallet of a wallet as the orchestrator does. Every other call answers as unimplemented.
func ExpectCoreWalletSetup ¶
func ExpectCoreWalletSetup(mock *mocks.MockBitcoinServiceClient)
ExpectCoreWalletSetup allows the calls the wallet engine makes in the background when it brings a Bitcoin Core wallet up. It asserts nothing: every argument matches, and zero calls pass. Its only job is to stop an unrelated background call from failing a test that cares about something else. A test that cares about one of these calls must set its own expectation, which gomock matches ahead of these.
func ExpectOrchestratorReads ¶
func ExpectOrchestratorReads(mock *mocks.MockWalletManagerServiceClient)
ExpectOrchestratorReads allows the read-only wallet-manager calls the engines make in the background. Like ExpectCoreWalletSetup it asserts nothing.
Note the node mode it reports is FULL, so a test that exercises light mode must set its own GetNodeMode expectation.
func ExpectOrchestratorReadsWithoutFrozenCoins ¶
func ExpectOrchestratorReadsWithoutFrozenCoins(mock *mocks.MockWalletManagerServiceClient)
ExpectOrchestratorReadsWithoutFrozenCoins is ExpectOrchestratorReads for a test that answers SetFrozenCoins itself.
Types ¶
type ServerOpt ¶
type ServerOpt func(opt *configg)
func WithBitcoind ¶
func WithBitcoind(bitcoind bitcoindv1alphaconnect.BitcoinServiceClient) ServerOpt
func WithBlockProducer ¶
func WithBlockProducer(producer mainchainv1connect.BlockProducerServiceClient) ServerOpt
func WithCoreWallet ¶
func WithCoreWallet() ServerOpt
WithCoreWallet makes the fixture wallet a Bitcoin Core one, for a test whose feature electrum cannot serve — deniability, for instance.
func WithCrypto ¶
func WithCrypto(crypto cryptov1connect.CryptoServiceClient) ServerOpt
func WithEncryptedWallet ¶
func WithEncryptedWallet() ServerOpt
WithEncryptedWallet marks the fixture wallet as encrypted, so the server starts with it locked.
func WithLocalAuth ¶
WithLocalAuth makes every route require the local-auth cookie in dir.
func WithNetwork ¶
WithNetwork runs the fixture on another network than regtest, for a test of behaviour the network itself decides.
func WithOrchestrator ¶
func WithOrchestrator(client orchrpc.WalletManagerServiceClient) ServerOpt
WithOrchestrator injects the wallet-manager client cheque reads go through.
func WithPasswordWallet ¶
func WithPasswordWallet() ServerOpt
WithPasswordWallet encrypts the electrum fixture wallet with EncryptedWalletPassword, so the server starts with it locked.
func WithValidator ¶
func WithValidator(validator mainchainv1connect.ValidatorServiceClient) ServerOpt
func WithWatchOnlyWallet ¶
func WithWatchOnlyWallet() ServerOpt
WithWatchOnlyWallet makes the fixture wallet a watch-only one with no seed.