channeldb: refactor payments code

Go-fmt files. Refactored code according to the guidelines.
Enhanced payment test: add error checking
and individual context for each API call.
Add Timestamp field to payment struct.
This commit is contained in:
BitfuryLightning
2016-12-21 04:19:01 -05:00
committed by Olaoluwa Osuntokun
parent eb4d0e035e
commit 1c7f87c3f1
5 changed files with 215 additions and 114 deletions

View File

@@ -116,8 +116,7 @@ func validateInvoice(i *Invoice) error {
// insertion will be aborted and rejected due to the strict policy banning any
// duplicate payment hashes.
func (d *DB) AddInvoice(i *Invoice) error {
err := validateInvoice(i)
if err != nil {
if err := validateInvoice(i); err != nil {
return err
}
return d.Update(func(tx *bolt.Tx) error {