aboutsummaryrefslogtreecommitdiffstats
path: root/accounts/account_manager.go
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2015-03-24 20:37:00 +0800
committerzelig <viktor.tron@gmail.com>2015-03-27 03:00:18 +0800
commitfd8d18ec280c3fe2c3d2651870c31c65b02039ba (patch)
treee079cd2306e48e8537b95e6c00730f611553a01e /accounts/account_manager.go
parent859f1f08ca48de99408c825eba8d6ed4bfea3235 (diff)
downloadgo-tangerine-fd8d18ec280c3fe2c3d2651870c31c65b02039ba.tar.gz
go-tangerine-fd8d18ec280c3fe2c3d2651870c31c65b02039ba.tar.zst
go-tangerine-fd8d18ec280c3fe2c3d2651870c31c65b02039ba.zip
unlocking coinbase
- extract accounts.getKey method - if given empty address it retrieves coinbase (first account) - cli -unlock coinbase will unlock coinbase
Diffstat (limited to 'accounts/account_manager.go')
-rw-r--r--accounts/account_manager.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/accounts/account_manager.go b/accounts/account_manager.go
index 670d4337f..21ef46991 100644
--- a/accounts/account_manager.go
+++ b/accounts/account_manager.go
@@ -101,6 +101,17 @@ func (am *Manager) firstAddr() ([]byte, error) {
return addrs[0], nil
}
+func (am *Manager) getKey(addr []byte, keyAuth string) (*crypto.Key, error) {
+ if len(addr) == 0 {
+ var err error
+ addr, err = am.firstAddr()
+ if err != nil {
+ return nil, err
+ }
+ }
+ return am.keyStore.GetKey(addr, keyAuth)
+}
+
func (am *Manager) DeleteAccount(address []byte, auth string) error {
return am.keyStore.DeleteKey(address, auth)
}
@@ -119,7 +130,7 @@ func (am *Manager) Sign(a Account, toSign []byte) (signature []byte, err error)
// TimedUnlock unlocks the account with the given address.
// When timeout has passed, the account will be locked again.
func (am *Manager) TimedUnlock(addr []byte, keyAuth string, timeout time.Duration) error {
- key, err := am.keyStore.GetKey(addr, keyAuth)
+ key, err := am.getKey(addr, keyAuth)
if err != nil {
return err
}
@@ -132,7 +143,7 @@ func (am *Manager) TimedUnlock(addr []byte, keyAuth string, timeout time.Duratio
// stays unlocked until the program exits or until a TimedUnlock
// timeout (started after the call to Unlock) expires.
func (am *Manager) Unlock(addr []byte, keyAuth string) error {
- key, err := am.keyStore.GetKey(addr, keyAuth)
+ key, err := am.getKey(addr, keyAuth)
if err != nil {
return err
}
miwi2008-08-101-0/+1 * ISC cron, successor of Vixie Cronedwin2008-08-071-0/+1 * vordog is a collection of a driver and a user space daemon for FreeBSD tomiwi2008-07-201-0/+1 * A simple script for automatic ZFS snapshot creation and removal of stalewxs2008-07-171-0/+1 * New port: sysutil/zccron A cron like tool that performs a single pass on a cr...edwin2008-07-091-0/+1 * [New port] sysutils/isomd5sum: Implanting and checking checksums within an IS...edwin2008-07-051-0/+1 * [NEW PORT] sysutils/fusefs-gunzipedwin2008-07-051-0/+1 * [UPDATE] sysutils/gnu-unifont update and category moved to x11-fonts & jfbter...edwin2008-07-051-1/+0 * On FreeBSD, it's possible to allow plain users to mount filesystemsamdmi32008-06-261-0/+1 * The sg3_utils package contains utilities that send SCSI commands to devices.lippe2008-06-231-0/+1 * New port: avfswxs2008-06-231-0/+1 * Archivemount is a piece of glue code between libarchivemiwi2008-06-211-0/+1 * Iterator_File is an attempt to take some repetition & tedium out ofchinsan2008-06-211-0/+1 * Add lxtask, a lightweight desktop-independent task manager.chinsan2008-06-211-0/+1 * [NEW PORT] sysutils/jtopen: a Java library to access OS/400 or i5/OS systemedwin2008-06-131-0/+1 * Hook sysutils/sge62 up post repocopy and upgrade to SGE 6.2beta.brooks2008-06-121-0/+1 * Lchown allows calls from Perl5 to lchown(2) enable changes to the ownership of amiwi2008-05-311-0/+1 * New Port: net/netident A port for testing what network a machineedwin2008-05-291-0/+1 * Add p5-Sys-Syslog 0.24, Perl interface to the UNIX syslog(3) calls.lth2008-05-281-0/+1 * Add zfs-replicate 0.4, a ZFS Snapshot Replication Script.vanilla2008-05-261-0/+1 * Add sysutils/conky-awesome after a repocopy from sysutils/conky.marcus2008-05-261-0/+1 * - add CryptoFS 0.6.0leeym2008-05-221-0/+1 * Reverse-resolve IP in Apache log files.chinsan2008-05-191-0/+1 * Archive the log files monthly.chinsan2008-05-191-0/+1 * dvtm brings the concept of tiling window management, popularized by X11-windowmiwi2008-05-181-0/+1 * cf is a filter that reads files or stdin and replaces numerictabthorpe2008-05-151-0/+1 * hf is a filter that reads files or stdin and replaces internettabthorpe2008-05-141-0/+1 * - Back out this committabthorpe2008-05-141-1/+0 * hf is a filter that reads files or stdin and replaces internettabthorpe2008-05-141-0/+1 * [new port] sysutils/automounteredwin2008-05-131-0/+1 * Add rsyslog 3.x to ports:sat2008-05-061-0/+7 * mdcp (Muli-Device Copy) is a command-line utility for *nix that providemiwi2008-05-031-0/+1 * - Remove sysutils/ack port is duplicate with textproc/p5-ackmiwi2008-04-301-1/+0 * ack is a tool like grep, aimed at programmers with large trees ofmiwi2008-04-301-0/+1 * tbku is a utility script for producing "tarball" backups of some- ormiwi2008-04-271-0/+1 * TclSyslog provides an easy to use interface to the Syslog daemon.wxs2008-04-171-0/+1 * - add chironfs 1.0.0leeym2008-04-071-0/+1 * aimage is the Advanced Disk Imager a tool to create forensic disk images.rafan2008-04-061-0/+1 * Split tracker into gnome and non-gnome portsahze2008-04-061-0/+3 * QuickSynergy is a graphical interface (GUI) for easily configuring Synergy2, anlme2008-03-291-0/+1 * The Advanced Forensics Format is an open and extensible file formatdesignedmiwi2008-03-261-0/+1 * The FreeBSD GNOME team is proud to annunce the release of GNOME 2.22.0 formarcus2008-03-241-1/+4 * This is port of Gentoo getdelta.sh.rafan2008-03-191-0/+1 * Add jfbterm 0.4.7, multilanguage can be displayed on the console.vanilla2008-03-191-0/+1 * Add gnu-unifont 1.0.0, unicode font.vanilla2008-03-191-0/+1 * Add sysutils/hpacuclibrooks2008-03-191-0/+1 * The sortu program is a replacement for the sort and uniq programs. It isjadawin2008-03-131-0/+1 * Logwatch is a customizable, pluggable log-monitoring system. It will gopav2008-03-131-0/+1 * - Update enlightenment-devel and EFL libraries to the latest snapshotstas2008-03-121-0/+1 * 2007-11-22 x11-themes/indubstrial: yesmiwi2008-02-281-1/+0 * 2007-10-31 www/vtiger4: This version is no longer supported by the developersmiwi2008-02-281-2/+0 * Probe::Perl - Information about the currently running perl.miwi2008-02-171-0/+1 * Tool for converting the UIF files (Universal Image Format, used bymiwi2008-02-161-0/+1 * Tool for converting the DAA files (Direct Access Archive, used bymiwi2008-02-161-0/+1 * Usage: relpath [-d DIR] START_DIR END_PATHbeech2008-02-151-0/+1 * Usage: decomment infile [r(emove whitespace)]beech2008-02-151-0/+1 * Hook sysutils/sge61 up to the buildbrooks2008-02-131-0/+1 * KleanSweep allows you to reclaim disk space by finding unneeded files.miwi2008-02-131-0/+1 * Complete the migration of sysutils/sge to sysutils/sge60.brooks2008-02-131-1/+1 * What's MyBashBurn?araujo2008-01-261-0/+1 * iograph counts network traffic for one interface and creates an accountingmiwi2008-01-231-0/+1 * - add swapd-1.0.3leeym2008-01-231-0/+1 * Apple's Time Machine is a great feature in their OS, and FreeBSD has almost alllme2008-01-221-0/+1 * Respond listens on stdin or on a specified named pipe and matchesaraujo2008-01-131-0/+1 * New port ispman-1.3r2beech2008-01-121-0/+1 * GOsa is a combination of system-administrator and end-user webpav2008-01-041-0/+1 * Add port sysutils/rsyslog-gssapi - a GSS API output modulesat2008-01-011-0/+1 * - Repocopy sysutils/xdd -> benchmarks/xdd since it's a better category for thisgarga2007-12-211-1/+0 * Command Line Interface for the Adaptec SCSI RAID family of RAID controllers,pav2007-12-201-0/+1 * ftwin is a tool useful to find duplicate files according to their contentmiwi2007-12-191-0/+1 * Add port sysutils/tm:sat2007-12-181-0/+1 * This is a quick-and-dirty LD_PRELOAD hack that allows *some* Gtkpav2007-12-171-0/+1 * CISO - tiny and easy to use tool to convert ISO imagesmiwi2007-12-161-0/+1 * pydf is all-singing, all-dancing, fully colourised df(1)-clonepav2007-12-151-0/+1 * USB developer utilities:edwin2007-12-141-0/+1 * - Add MySQL and PostgreSQL output modules for rsyslogsat2007-12-141-0/+2 * Add p5-Filesys-DfPortable 0.85, Perl extension forlth2007-12-121-0/+1 * cdrkit is a suite of programs for recording CDs and DVDs, blanking CD-RW media,pav2007-12-121-0/+1 * Add usbutils, which contains the popular lsusb(8) utility for listingbrix2007-12-121-0/+1 * k8temp is a utility to read the on-die temperature sensors provided bymiwi2007-10-241-0/+1 * rsyncbackup is a perlscript that reads configuration files for sourcesrafan2007-10-101-0/+1 * Add weedit, a file duplicate scanner with database support.ehaupt2007-10-091-0/+1 * Remove sysutils/nut-libupsclient sysutils/nut-snmp sysutils/nut-usbmm2007-10-071-3/+0 * - Complete repocopy of sysutils/puppet-devel and apply patch.alepulver2007-09-281-0/+1 * [NEW PORT] sysutils/bacula-bat GUI for sysutils/bacula-serveredwin2007-09-241-0/+1 * 2007-09-15 x11-wm/obtuner: broken with recent Openbox and the project is not ...miwi2007-09-181-1/+0 * The Java Service Wrapper is an application which has evolved out of a desirealepulver2007-09-141-0/+1 * Sick of all those fancy CD-burning apps not working for you? You needalepulver2007-09-141-0/+1 * Back out 1.944. The port itself was named wrong, not the Makefile entry.linimon2007-09-141-1/+1 * Fix typo in linux-procfs entry.erwin2007-09-091-1/+1 * [NEW PORT] sysutils/clonehdd: Perl script for partition clone in FreeBSDedwin2007-09-081-0/+1 * Fix typo in name:edwin2007-09-081-1/+1 * New port: sysutils/mtpfs MTP device filesystemedwin2007-09-081-0/+1 * New port: sysutils/cciss_vol_statusmm2007-09-071-0/+1 * New port: sysutil/linux-procfs rpm port of procpsedwin2007-09-071-0/+1 * - New port htopbeech2007-08-311-0/+1 * Add ConsoleKit, a framework for defining and tracking users. It's requiredflz2007-08-271-0/+1 * New port: fusefs-podfjoe2007-08-231-0/+1 * Add port sysutils/ddrescue:sat2007-08-161-0/+1 * Add port sysutils/fusefs-wikipediafs:sat2007-08-111-0/+1 * Nitrogen is a background browser and setter for X windows. It is writtenrafan2007-07-311-0/+1 * Add usbhotkey 0.2, a utility to remap USB keyboards under X11.lwhsu2007-07-281-0/+1 * God is an easy to configure, easy to extend monitoringmiwi2007-07-231-0/+1 * - Add a separate port for microcode updates to let people update microcodestas2007-07-201-0/+1 * - Update hachoir suite:sat2007-07-141-0/+1 * Add port sysutils/rsyslog:sat2007-07-101-0/+1 * Obsolete port no more maintained by its author.jmz2007-07-061-1/+0 * GoogLog is a easy and simple web tool to search inside your syslog files.araujo2007-06-301-0/+1 * - Resurrect and fix ledit, a line editor allowing to use control commands likebarner2007-06-251-0/+1 * GAI Leds is a GAI applet that displays the keyboard status leds.pav2007-06-171-0/+1 * pyRenamer is a mass file renamer written in PyGTK. You can rename files usingmezz2007-06-151-0/+1 * Add port sysutils/reclinker:sat2007-06-121-0/+1 * Perl interface to Gamin (File Access Monitor implementation)miwi2007-06-111-0/+1 * Add p5-Brackup 1.03, flexible backup tool.clsung2007-06-071-0/+1 * Condor is a open-source, specialized workload management system formiwi2007-06-051-0/+1 * Bcfg2 helps system administrators produce a consistent, reproducible, andmiwi2007-06-051-0/+1 * Remove expired ports:gabor2007-06-041-1/+0 * A set of shell scripts for managing LDAP POSIX user and group creationmiwi2007-06-041-0/+1 * snap is a tool for the management of UFS2 snapshots createdmiwi2007-06-041-0/+1 * - Retire gstreamer 0.8.0ahze2007-06-021-1/+0 * From the web site:bsam2007-05-261-0/+1 * Add p5-mogilefs-server 2.10.919, mogileFS (distributed filesystem)clsung2007-05-041-0/+1