@Before public void setUp() throws Exception { BriefLogFormatter.initVerbose(); Context ctx = new Context(params); myWatchedKey = new ECKey(); myWallet = new Wallet(params); myKey = new ECKey(); myKey.setCreationTimeSeconds(123456789L); myWallet.importKey(myKey); myAddress = myKey.toAddress(params); myWallet = new Wallet(params); myWallet.importKey(myKey); mScriptCreationTime = new Date().getTime() / 1000 - 1234; myWallet.addWatchedAddress(myWatchedKey.toAddress(params), mScriptCreationTime); myWallet.setDescription(WALLET_DESCRIPTION); }
/** * The creation time of a deterministic key is equal to that of its parent, unless this key is the * root of a tree. Thus, setting the creation time on a leaf is forbidden. */ @Override public void setCreationTimeSeconds(long newCreationTimeSeconds) { if (parent != null) throw new IllegalStateException("Creation time can only be set on root keys."); else super.setCreationTimeSeconds(newCreationTimeSeconds); }