multi: rename ReadTx to RTx
This commit is contained in:
44 files changed
+167
-168
No files matched your search
@@ -180,7 +180,7 @@ func fileExists(path string) bool {
|
||||
func (d *DB) FetchClosedChannels(pendingOnly bool) ([]*ChannelCloseSummary, error) {
|
||||
var chanSummaries []*ChannelCloseSummary
|
||||
|
||||
if err := kvdb.View(d, func(tx kvdb.ReadTx) error {
|
||||
if err := kvdb.View(d, func(tx kvdb.RTx) error {
|
||||
closeBucket := tx.ReadBucket(closedChannelBucket)
|
||||
if closeBucket == nil {
|
||||
return ErrNoClosedChannels
|
||||
|
||||
@@ -175,7 +175,7 @@ func newChannelGraph(db *DB, rejectCacheSize, chanCacheSize int) *ChannelGraph {
|
||||
// node based off the source node.
|
||||
func (c *ChannelGraph) SourceNode() (*LightningNode, error) {
|
||||
var source *LightningNode
|
||||
err := kvdb.View(c.db, func(tx kvdb.ReadTx) error {
|
||||
err := kvdb.View(c.db, func(tx kvdb.RTx) error {
|
||||
// First grab the nodes bucket which stores the mapping from
|
||||
// pubKey to node information.
|
||||
nodes := tx.ReadBucket(nodeBucket)
|
||||
|
||||
@@ -252,7 +252,7 @@ func validateInvoice(i *Invoice) error {
|
||||
func (d *DB) FetchAllInvoices(pendingOnly bool) ([]Invoice, error) {
|
||||
var invoices []Invoice
|
||||
|
||||
err := kvdb.View(d, func(tx kvdb.ReadTx) error {
|
||||
err := kvdb.View(d, func(tx kvdb.RTx) error {
|
||||
invoiceB := tx.ReadBucket(invoiceBucket)
|
||||
if invoiceB == nil {
|
||||
return ErrNoInvoicesCreated
|
||||
|
||||
@@ -104,7 +104,7 @@ func (db *DB) addPayment(payment *outgoingPayment) error {
|
||||
func (db *DB) fetchAllPayments() ([]*outgoingPayment, error) {
|
||||
var payments []*outgoingPayment
|
||||
|
||||
err := kvdb.View(db, func(tx kvdb.ReadTx) error {
|
||||
err := kvdb.View(db, func(tx kvdb.RTx) error {
|
||||
bucket := tx.ReadBucket(paymentBucket)
|
||||
if bucket == nil {
|
||||
return ErrNoPaymentsCreated
|
||||
@@ -140,7 +140,7 @@ func (db *DB) fetchAllPayments() ([]*outgoingPayment, error) {
|
||||
// NOTE: Deprecated. Kept around for migration purposes.
|
||||
func (db *DB) fetchPaymentStatus(paymentHash [32]byte) (PaymentStatus, error) {
|
||||
var paymentStatus = StatusUnknown
|
||||
err := kvdb.View(db, func(tx kvdb.ReadTx) error {
|
||||
err := kvdb.View(db, func(tx kvdb.RTx) error {
|
||||
var err error
|
||||
paymentStatus, err = fetchPaymentStatusTx(tx, paymentHash)
|
||||
return err
|
||||
@@ -158,7 +158,7 @@ func (db *DB) fetchPaymentStatus(paymentHash [32]byte) (PaymentStatus, error) {
|
||||
// can be composed into other atomic operations.
|
||||
//
|
||||
// NOTE: Deprecated. Kept around for migration purposes.
|
||||
func fetchPaymentStatusTx(tx kvdb.ReadTx, paymentHash [32]byte) (PaymentStatus, error) {
|
||||
func fetchPaymentStatusTx(tx kvdb.RTx, paymentHash [32]byte) (PaymentStatus, error) {
|
||||
// The default status for all payments that aren't recorded in database.
|
||||
var paymentStatus = StatusUnknown
|
||||
|
||||
@@ -375,7 +375,7 @@ func deserializeHopMigration9(r io.Reader) (*Hop, error) {
|
||||
func (db *DB) fetchPaymentsMigration9() ([]*Payment, error) {
|
||||
var payments []*Payment
|
||||
|
||||
err := kvdb.View(db, func(tx kvdb.ReadTx) error {
|
||||
err := kvdb.View(db, func(tx kvdb.RTx) error {
|
||||
paymentsBucket := tx.ReadBucket(paymentsRootBucket)
|
||||
if paymentsBucket == nil {
|
||||
return nil
|
||||
|
||||
@@ -404,7 +404,7 @@ func TestMigrateOptionalChannelCloseSummaryFields(t *testing.T) {
|
||||
newSerialization := b.Bytes()
|
||||
|
||||
var dbSummary []byte
|
||||
err = kvdb.View(d, func(tx kvdb.ReadTx) error {
|
||||
err = kvdb.View(d, func(tx kvdb.RTx) error {
|
||||
closedChanBucket := tx.ReadBucket(closedChannelBucket)
|
||||
if closedChanBucket == nil {
|
||||
return errors.New("unable to find bucket")
|
||||
@@ -503,7 +503,7 @@ func TestMigrateGossipMessageStoreKeys(t *testing.T) {
|
||||
// 3. The message matches the original.
|
||||
afterMigration := func(db *DB) {
|
||||
var rawMsg []byte
|
||||
err := kvdb.View(db, func(tx kvdb.ReadTx) error {
|
||||
err := kvdb.View(db, func(tx kvdb.RTx) error {
|
||||
messageStore := tx.ReadBucket(messageStoreBucket)
|
||||
if messageStore == nil {
|
||||
return errors.New("message store bucket not " +
|
||||
|
||||
@@ -254,7 +254,7 @@ type Payment struct {
|
||||
func (db *DB) FetchPayments() ([]*Payment, error) {
|
||||
var payments []*Payment
|
||||
|
||||
err := kvdb.View(db, func(tx kvdb.ReadTx) error {
|
||||
err := kvdb.View(db, func(tx kvdb.RTx) error {
|
||||
paymentsBucket := tx.ReadBucket(paymentsRootBucket)
|
||||
if paymentsBucket == nil {
|
||||
return nil
|
||||
|
||||
Reference in new issue
Block a user