mirror of
https://github.com/AthanorLabs/atomic-swap.git
synced 2026-01-10 06:38:04 -05:00
* version independent monerod path with localhost-only binding * fixed lint target and install script * created 3rd ETH key constant to avoid race condition in tests * updated run-integration-tests.sh with the same changes made to run-unit-tests.sh * new design for paritioning out 2 unique keys to test packages * restored accidentally deleted tests/alice.key * removed websocket connection leaks from tests * made file paths unique between tests with better file cleanup * fix for the websocket connection leak commit * reverted increase of GenerateBlocks (didn't mean to commit that) * fixed maker/taker key that I had reversed * fixed incorrect zero-balance check * fixed comment on ClaimOrRefund * added back sample script for installing go in /usr/local/go * etchclient creation cleanup using t.Cleanup() * minor cleanup to ganache_test_keys code * initial dynamic monero-wallet-rpc implementation for tests * converted monero tests to use dynamic monero-wallet-rpc services * unit tests all using dynamic monero-wallet-rpc services * fixed 2 tests that failed after moving to dynamic monero-wallet-rpc services * fixed low balance issues in TestSwapState_NotifyClaimed Co-authored-by: noot <36753753+noot@users.noreply.github.com>
37 lines
1.1 KiB
Go
37 lines
1.1 KiB
Go
package protocol
|
|
|
|
import (
|
|
"fmt"
|
|
"path"
|
|
"time"
|
|
|
|
"github.com/noot/atomic-swap/net/message"
|
|
"github.com/noot/atomic-swap/swapfactory"
|
|
)
|
|
|
|
// GetSwapInfoFilepath returns an info file path with the current timestamp.
|
|
func GetSwapInfoFilepath(basePath string) string {
|
|
t := time.Now().Format("2006-01-02-15:04:05.999999999")
|
|
return path.Join(basePath, t)
|
|
}
|
|
|
|
// GetSwapRecoveryFilepath returns an info file path with the current timestamp.
|
|
func GetSwapRecoveryFilepath(basePath string) string {
|
|
t := time.Now().Format("2006-01-02-15:04:05.999999999")
|
|
return path.Join(basePath, fmt.Sprintf("recovery-%s.txt", t))
|
|
}
|
|
|
|
// ConvertContractSwapToMsg converts a swapfactory.SwapFactorySwap to a *message.ContractSwap
|
|
func ConvertContractSwapToMsg(swap swapfactory.SwapFactorySwap) *message.ContractSwap {
|
|
return &message.ContractSwap{
|
|
Owner: swap.Owner,
|
|
Claimer: swap.Claimer,
|
|
PubKeyClaim: swap.PubKeyClaim,
|
|
PubKeyRefund: swap.PubKeyRefund,
|
|
Timeout0: swap.Timeout0,
|
|
Timeout1: swap.Timeout1,
|
|
Value: swap.Value,
|
|
Nonce: swap.Nonce,
|
|
}
|
|
}
|