public boolean disconnect ( ) { TransactionOutput connectedOutput ; if ( outpoint . fromTx != null ) { // The outpoint is connected using a "standard" wallet, disconnect it. connectedOutput = outpoint . fromTx . getOutput ( ( int ) outpoint . getIndex ( ) ) ; outpoint . fromTx = null ; } else if ( outpoint . connectedOutput != null ) { // The outpoint is connected using a UTXO based wallet, disconnect it. connectedOutput = outpoint . connectedOutput ; outpoint . connectedOutput = null ; } else { // The outpoint is not connected, do nothing. return false ; } if ( connectedOutput != null && connectedOutput . getSpentBy ( ) == this ) { // The outpoint was connected to an output, disconnect the output. connectedOutput . markAsUnspent ( ) ; return true ; } else { return false ; } }
If this input is connected check the output is connected back to this input and release it if so making it spendable once again .